<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=2"><meta name="theme-color" content="#FFF"><meta name="baidu-site-verification" content="code-DvHFUp3jdk"><meta name="baidu-site-verification" content="code-eHnRZZHAeP"><meta name="baidu-site-verification" content="code-EmlZBboqEW"><meta name="baidu-site-verification" content="code-Hf9ZXEHZ41"><meta name="360-site-verification" content="941073b91e9afaf02748ba000ba47e80"><meta name="360-site-verification" content="010bd45f0d523ce46f298dd597ef0289"><meta name="sogou_site_verification" content="hlLPNfmIjv"><meta name="sogou_site_verification" content="y3La2dTB20"><meta name="msvalidate.01" content="03829B28CC46A7AA4B5503897F475BA1"><script>!function(){var s="https://s.ssl.qhres2.com/ssl/ab77b6ea7f3fbf79.js";document.write('<script src="'+s+'" id="sozz"><\/script>')}()</script><script>!function(t,e,c,n,r,a,s){t[c]=t[c]||function(){(t[c].q=t[c].q||[]).push(arguments)},a=e.createElement(n),a.async=1,a.src="https://www.clarity.ms/tag/"+r+"?ref=bwt",s=e.getElementsByTagName(n)[0],s.parentNode.insertBefore(a,s)}(window,document,"clarity","script","8xwpfccwj2")</script><script>var _hmt=_hmt||[];!function(){var e=document.createElement("script");e.src="https://hm.baidu.com/hm.js?1d318b0509ca0909017253ed6f659ae4";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)}()</script><script>var _hmt=_hmt||[];!function(){var e=document.createElement("script");e.src="https://hm.baidu.com/hm.js?aea6c1471d6299bdd1c87a0836f18675";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)}()</script><script>var _hmt=_hmt||[];!function(){var e=document.createElement("script");e.src="https://hm.baidu.com/hm.js?498ca413655655a62058d6b5d7c62786";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)}()</script><script>var _hmt=_hmt||[];!function(){var e=document.createElement("script");e.src="https://hm.baidu.com/hm.js?e19e8161e13f718806b79f49240583b4";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)}()</script><link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon.png"><link rel="icon" type="image/ico" sizes="32x32" href="/images/favicon.ico"><meta http-equiv="Cache-Control" content="no-transform"><meta http-equiv="Cache-Control" content="no-siteapp"><meta name="google-site-verification" content="UA-139249935-1"><meta name="baidu-site-verification" content="cOtBu9CtTEIuwJeN"><link rel="alternate" type="application/rss+xml" title="了尘兰若的小坑" href="https://liaochenlanruo.gitee.io/rss.xml"><link rel="alternate" type="application/atom+xml" title="了尘兰若的小坑" href="https://liaochenlanruo.gitee.io/atom.xml"><link rel="alternate" type="application/json" title="了尘兰若的小坑" href="https://liaochenlanruo.gitee.io/feed.json"><link rel="stylesheet" href="//fonts.googleapis.com/css?family=Mulish:300,300italic,400,400italic,700,700italic%7CFredericka%20the%20Great:300,300italic,400,400italic,700,700italic%7CNoto%20Serif%20JP:300,300italic,400,400italic,700,700italic%7CNoto%20Serif%20SC:300,300italic,400,400italic,700,700italic%7CInconsolata:300,300italic,400,400italic,700,700italic&display=swap&subset=latin,latin-ext"><link rel="stylesheet" href="/css/app.css?v=0.2.5"><meta name="keywords" content="生信软件,代谢组"><link rel="canonical" href="https://liaochenlanruo.gitee.io/post/377e.html"><title>使用xcms3处理和分析LC-MS数据 - 生物信息 | ResearchGo = 了尘兰若的小坑 = liaochenlanruo</title><meta name="generator" content="Hexo 5.4.0"></head><body itemscope itemtype="http://schema.org/WebPage"><div id="loading"><div class="cat"><div class="body"></div><div class="head"><div class="face"></div></div><div class="foot"><div class="tummy-end"></div><div class="bottom"></div><div class="legs left"></div><div class="legs right"></div></div><div class="paw"><div class="hands left"></div><div class="hands right"></div></div></div></div><div id="container"><header id="header" itemscope itemtype="http://schema.org/WPHeader"><div class="inner"><div id="brand"><div class="pjax"><h1 itemprop="name headline">使用xcms3处理和分析LC-MS数据</h1><div class="meta"><span class="item" title="Created: 2023-02-06 15:45:39"><span class="icon"><i class="ic i-calendar"></i> </span><span class="text">Posted on</span> <time itemprop="dateCreated datePublished" datetime="2023-02-06T15:45:39+08:00">2023-02-06</time> </span><span class="item" title="Symbols count in article"><span class="icon"><i class="ic i-pen"></i> </span><span class="text">Symbols count in article</span> <span>30k</span> <span class="text">words</span> </span><span class="item" title="Reading time"><span class="icon"><i class="ic i-clock"></i> </span><span class="text">Reading time</span> <span>28 mins.</span></span></div></div></div><nav id="nav"><div class="inner"><div class="toggle"><div class="lines" aria-label="Toggle navigation bar"><span class="line"></span> <span class="line"></span> <span class="line"></span></div></div><ul class="menu"><li class="item title"><a href="/" rel="start">ResearchGo</a></li></ul><ul class="right"><li class="item theme"><i class="ic i-sun"></i></li><li class="item search"><i class="ic i-search"></i></li></ul></div></nav></div><div id="imgs" class="pjax"><img src="https://cdn.jsdelivr.net/gh/liaochenlanruo/cdn@master/img/custom/bgs/thumb_102.webp"></div></header><div id="waves"><svg class="waves" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 24 150 28" preserveAspectRatio="none" shape-rendering="auto"><defs><path id="gentle-wave" d="M-160 44c30 0 58-18 88-18s 58 18 88 18 58-18 88-18 58 18 88 18 v44h-352z"/></defs><g class="parallax"><use xlink:href="#gentle-wave" x="48" y="0"/><use xlink:href="#gentle-wave" x="48" y="3"/><use xlink:href="#gentle-wave" x="48" y="5"/><use xlink:href="#gentle-wave" x="48" y="7"/></g></svg></div><main><div class="inner"><div id="main" class="pjax"><div class="article wrap"><div class="breadcrumb" itemscope itemtype="https://schema.org/BreadcrumbList"><i class="ic i-home"></i> <span><a href="/">Home</a></span><i class="ic i-angle-right"></i> <span class="current" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"><a href="/categories/Bioinformatics/" itemprop="item" rel="index" title="In 生物信息"><span itemprop="name">生物信息</span></a><meta itemprop="position" content="1"></span></div><article itemscope itemtype="http://schema.org/Article" class="post block" lang="en"><link itemprop="mainEntityOfPage" href="https://liaochenlanruo.gitee.io/post/377e.html"><span hidden itemprop="author" itemscope itemtype="http://schema.org/Person"><meta itemprop="image" content="/images/head.jpg"><meta itemprop="name" content="Hualin Liu"><meta itemprop="description" content="liaochenlanruo, 分享微生物生物信息学分析方法，欢迎加入QQ群交流945751012，不接受群内广告！"></span><span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization"><meta itemprop="name" content="了尘兰若的小坑"></span><div class="body md" itemprop="articleBody"><div class="gallery" itemscope itemtype="http://schema.org/ImageGallery"><img data-src="https://cdn.jsdelivr.net/gh/liaochenlanruo/cdn@master/img/custom/bgs/thumb_102.webp" itemprop="contentUrl"></div><h1 id="介绍"><a class="anchor" href="#介绍">#</a> 介绍</h1><p>本文档描述了 xcms（version&gt;=3）的 LCMS 实验的数据导入、探索、预处理和分析。示例和基本工作流程改编自 Colin A.Smith 的原始 LC/MS 预处理和分析。</p><p>新版本使用 <code>XCMSnExpe</code> 对象（而不是旧的 xcmsSet 对象）作为预处理结果的容器。然而，为了支持依赖于 xcmsSet 对象的包和管道，可以使用 as 方法（即 xset&lt;-as (x, &quot;xcmsSet&quot;)）将 XCMSnExpe 转换为 xcmsSet 对象，其中 x 是 XCMSnxp 对象。</p><h1 id="安装"><a class="anchor" href="#安装">#</a> 安装</h1><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre><span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span>require<span class="token punctuation">(</span><span class="token string">"BiocManager"</span><span class="token punctuation">,</span> quietly <span class="token operator">=</span> <span class="token boolean">TRUE</span><span class="token punctuation">)</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="2"></td><td><pre>    install.packages<span class="token punctuation">(</span><span class="token string">"BiocManager"</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="3"></td><td><pre></pre></td></tr><tr><td data-num="4"></td><td><pre>BiocManager<span class="token operator">::</span>install<span class="token punctuation">(</span><span class="token string">"xcms"</span><span class="token punctuation">)</span></pre></td></tr></table></figure><h1 id="导入数据"><a class="anchor" href="#导入数据">#</a> 导入数据</h1><p>xcms 支持（AIA/ANDI）NetCDF、mzXML 和 mzML 格式的 LC/MS 数据。对于实际数据导入，使用 Bioconductor 的<span class="exturl" data-url="aHR0cHM6Ly9iaW9jb25kdWN0b3Iub3JnL3BhY2thZ2VzLzMuMTUvbXpS"> mzR</span>。出于演示目的，我们将分析 [1] 中的数据子集，其研究了敲除脂肪酸酰胺水解酶（FAAH）基因在小鼠中的代谢后果。原始数据文件（NetCDF 格式）随 <code>faahKO</code> 数据包提供。数据集包括来自 6 只敲除小鼠和 6 只野生型小鼠脊髓的样本。每个文件包含在正离子模式下以 200-600 m/z 和 2500-4500 秒采集的质心模式（centroid mode）数据。为了加快处理速度，我们仅分析 8 个文件，且限定保留时间范围为 2500 到 3500 秒。</p><p>下面我们加载所有必需的包，在 <code>faahKO</code> 包中找到原始 CDF 文件，并构建描述实验设置的表型（phenodata）数据框。注意，对于实际实验，建议定义一个文件（表），其中包含原始数据文件的文件名以及每个文件的样本描述，作为附加列。然后，可以使用例如 <code>read.table</code> 导入该文件作为变量 pd（而不是在下面的示例中在 R 中定义），并且可以将文件名传递给下面的 <code>readMSData</code> 函数，例如 <code>files=paste0(MZML_PATH, &quot;/&quot;, pd$MZML_file)</code> ，其中 <code>MZML_PATH</code> 是文件所在目录的路径， <code>&quot;mzMLfile&quot;</code> 是 phenodata 文件中包含文件名那一列的<strong>列名</strong>。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>library<span class="token punctuation">(</span>xcms<span class="token punctuation">)</span></pre></td></tr><tr><td data-num="2"></td><td><pre>library<span class="token punctuation">(</span>faahKO<span class="token punctuation">)</span></pre></td></tr><tr><td data-num="3"></td><td><pre>library<span class="token punctuation">(</span>RColorBrewer<span class="token punctuation">)</span></pre></td></tr><tr><td data-num="4"></td><td><pre>library<span class="token punctuation">(</span>pander<span class="token punctuation">)</span></pre></td></tr><tr><td data-num="5"></td><td><pre>library<span class="token punctuation">(</span>magrittr<span class="token punctuation">)</span></pre></td></tr><tr><td data-num="6"></td><td><pre>library<span class="token punctuation">(</span>pheatmap<span class="token punctuation">)</span></pre></td></tr><tr><td data-num="7"></td><td><pre>library<span class="token punctuation">(</span>SummarizedExperiment<span class="token punctuation">)</span></pre></td></tr><tr><td data-num="8"></td><td><pre></pre></td></tr><tr><td data-num="9"></td><td><pre><span class="token comment">## Get the full path to the CDF files</span></pre></td></tr><tr><td data-num="10"></td><td><pre>cdfs <span class="token operator">&lt;-</span> dir<span class="token punctuation">(</span>system.file<span class="token punctuation">(</span><span class="token string">"cdf"</span><span class="token punctuation">,</span> package <span class="token operator">=</span> <span class="token string">"faahKO"</span><span class="token punctuation">)</span><span class="token punctuation">,</span> full.names <span class="token operator">=</span> <span class="token boolean">TRUE</span><span class="token punctuation">,</span> recursive <span class="token operator">=</span> <span class="token boolean">TRUE</span><span class="token punctuation">)</span><span class="token punctuation">[</span>c<span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">,</span> <span class="token number">6</span><span class="token punctuation">,</span> <span class="token number">7</span><span class="token punctuation">,</span> <span class="token number">8</span><span class="token punctuation">,</span> <span class="token number">11</span><span class="token punctuation">,</span> <span class="token number">12</span><span class="token punctuation">)</span><span class="token punctuation">]</span></pre></td></tr><tr><td data-num="11"></td><td><pre><span class="token comment">## Create a phenodata data.frame</span></pre></td></tr><tr><td data-num="12"></td><td><pre>pd <span class="token operator">&lt;-</span> data.frame<span class="token punctuation">(</span>sample_name <span class="token operator">=</span> sub<span class="token punctuation">(</span>basename<span class="token punctuation">(</span>cdfs<span class="token punctuation">)</span><span class="token punctuation">,</span> pattern <span class="token operator">=</span> <span class="token string">".CDF"</span><span class="token punctuation">,</span> replacement <span class="token operator">=</span> <span class="token string">""</span><span class="token punctuation">,</span> fixed <span class="token operator">=</span> <span class="token boolean">TRUE</span><span class="token punctuation">)</span><span class="token punctuation">,</span> sample_group <span class="token operator">=</span> c<span class="token punctuation">(</span>rep<span class="token punctuation">(</span><span class="token string">"KO"</span><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">)</span><span class="token punctuation">,</span> rep<span class="token punctuation">(</span><span class="token string">"WT"</span><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span> stringsAsFactors <span class="token operator">=</span> <span class="token boolean">FALSE</span><span class="token punctuation">)</span></pre></td></tr></table></figure><p>随后，我们使用 <code>MSnbase</code> 包中的 <code>readMSData</code> 方法将原始数据加载为 <code>OnDiskMSnExpe</code> 对象。MSnbase 为质谱数据处理提供了基础结构和基础设施。此外，MSnbase 可用于形心剖面模式（centroid profile-mode）MS 数据（参见 MSnbase 包中的相应介绍）。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>raw_data <span class="token operator">&lt;-</span> readMSData<span class="token punctuation">(</span>files <span class="token operator">=</span> cdfs<span class="token punctuation">,</span> pdata <span class="token operator">=</span> new<span class="token punctuation">(</span><span class="token string">"NAnnotatedDataFrame"</span><span class="token punctuation">,</span> pd<span class="token punctuation">)</span><span class="token punctuation">,</span> mode <span class="token operator">=</span> <span class="token string">"onDisk"</span><span class="token punctuation">)</span></pre></td></tr></table></figure><p>接下来，我们将数据集限制在 2500 到 3500 秒的保留时间范围内。这仅仅是为了减少该示例的处理时间。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>raw_data <span class="token operator">&lt;-</span> filterRt<span class="token punctuation">(</span>raw_data<span class="token punctuation">,</span> c<span class="token punctuation">(</span><span class="token number">2500</span><span class="token punctuation">,</span> <span class="token number">3500</span><span class="token punctuation">)</span><span class="token punctuation">)</span></pre></td></tr></table></figure><p>生成的 <code>OnDiskMSnExpe</code> 对象包含关于 spectrum 数量、保留时间、测量的总离子电流等的一般信息，但不包含完整的原始数据（即每个测量光谱的 m/z 和强度值）。因此，它的内存占用相当小，是代表大型代谢组学实验的理想对象，同时允许执行简单的质量控制、数据检查和探索以及数据取子集操作。m/z 和强度值根据需要从原始数据文件中导入，因此原始数据文件的位置在初始数据导入后不应更改。</p><h1 id="初始数据检查"><a class="anchor" href="#初始数据检查">#</a> 初始数据检查</h1><p><code>OnDiskMSnExp</code> 按 spectrum 组织 MS 数据，并提供 <code>intensity</code> 、 <code>mz</code> 和 <code>rtime</code> 方法以访问文件中的原始数据（测量的强度值、相应的 m/z 和保留时间值）。此外， <code>spectra</code> 方法可用于返回封装在 spectrum 对象中的所有数据。下面我们从对象中提取保留时间值。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>head<span class="token punctuation">(</span>rtime<span class="token punctuation">(</span>raw_data<span class="token punctuation">)</span><span class="token punctuation">)</span></pre></td></tr></table></figure><figure class="highlight text"><figcaption data-lang="text"></figcaption><table><tr><td data-num="1"></td><td><pre>## F1.S0001 F1.S0002 F1.S0003 F1.S0004 F1.S0005 F1.S0006 </pre></td></tr><tr><td data-num="2"></td><td><pre>## 2501.378 2502.943 2504.508 2506.073 2507.638 2509.203</pre></td></tr></table></figure><p>即使实验由多个文件 / 样本组成，所有数据都会作为一维矢量（one-dimensional vectors，rtime 的一个数值型向量，一个向量列表 for mz 和 intensity，每个各自都包含一个 spectrum 的值）返回。 <code>fromFile</code> 函数返回一个整型向量，提供值到原始文件的映射。下面我们使用 <code>fromFile</code> 索引按文件组织 <code>mz</code> 值。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>mzs <span class="token operator">&lt;-</span> mz<span class="token punctuation">(</span>raw_data<span class="token punctuation">)</span></pre></td></tr><tr><td data-num="2"></td><td><pre></pre></td></tr><tr><td data-num="3"></td><td><pre><span class="token comment">## Split the list by file</span></pre></td></tr><tr><td data-num="4"></td><td><pre>mzs_by_file <span class="token operator">&lt;-</span> split<span class="token punctuation">(</span>mzs<span class="token punctuation">,</span> f <span class="token operator">=</span> fromFile<span class="token punctuation">(</span>raw_data<span class="token punctuation">)</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="5"></td><td><pre></pre></td></tr><tr><td data-num="6"></td><td><pre>length<span class="token punctuation">(</span>mzs_by_file<span class="token punctuation">)</span></pre></td></tr></table></figure><figure class="highlight text"><figcaption data-lang="text"></figcaption><table><tr><td data-num="1"></td><td><pre>## [1] 8</pre></td></tr></table></figure><p>作为数据的第一次评估，我们在实验中绘制了每个文件的基峰色谱图（base peak chromatogram, BPC）。我们使用 <code>chromatogram</code> 方法并将 <code>aggregationFun</code> 设置为 <code>&quot;max&quot;</code> ，以返回每个 spectrum 的最大强度，从而根据原始数据创建 BPC。为了创建总离子色谱图（total ion chromatogram），我们可以将 <code>aggregationFun</code> 设置为 <code>sum</code> 。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre><span class="token comment">## Get the base peak chromatograms. This reads data from the files.</span></pre></td></tr><tr><td data-num="2"></td><td><pre>bpis <span class="token operator">&lt;-</span> chromatogram<span class="token punctuation">(</span>raw_data<span class="token punctuation">,</span> aggregationFun <span class="token operator">=</span> <span class="token string">"max"</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="3"></td><td><pre><span class="token comment">## Define colors for the two groups</span></pre></td></tr><tr><td data-num="4"></td><td><pre>group_colors <span class="token operator">&lt;-</span> paste0<span class="token punctuation">(</span>brewer.pal<span class="token punctuation">(</span><span class="token number">3</span><span class="token punctuation">,</span> <span class="token string">"Set1"</span><span class="token punctuation">)</span><span class="token punctuation">[</span><span class="token number">1</span><span class="token operator">:</span><span class="token number">2</span><span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token string">"60"</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="5"></td><td><pre>names<span class="token punctuation">(</span>group_colors<span class="token punctuation">)</span> <span class="token operator">&lt;-</span> c<span class="token punctuation">(</span><span class="token string">"KO"</span><span class="token punctuation">,</span> <span class="token string">"WT"</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="6"></td><td><pre></pre></td></tr><tr><td data-num="7"></td><td><pre><span class="token comment">## Plot all chromatograms.</span></pre></td></tr><tr><td data-num="8"></td><td><pre>png<span class="token punctuation">(</span>file<span class="token operator">=</span><span class="token string">"xcms_1.png"</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="9"></td><td><pre>plot<span class="token punctuation">(</span>bpis<span class="token punctuation">,</span> col <span class="token operator">=</span> group_colors<span class="token punctuation">[</span>raw_data<span class="token operator">$</span>sample_group<span class="token punctuation">]</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="10"></td><td><pre>dev.off<span class="token punctuation">(</span><span class="token punctuation">)</span></pre></td></tr></table></figure><p><img data-src="https://fastly.jsdelivr.net/gh/liaochenlanruo/cdn@master/img/custom/metabolomics/xcms_1.png" alt="MChromatograms"></p><p><code>chromatogram</code> 返回了一个 <code>MCchromatograms</code> 对象，该对象以二维矩阵形式组织各个 <code>Chromatogram</code> 对象（实际上包含 chromatographic 数据）：列表示样本，行（可选）表示 m/z 和 / 或保留时间范围。下面我们提取第一个样品的 chromatogram，并获取其保留时间和强度值。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>bpi_1 <span class="token operator">&lt;-</span> bpis<span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">]</span></pre></td></tr><tr><td data-num="2"></td><td><pre>head<span class="token punctuation">(</span>rtime<span class="token punctuation">(</span>bpi_1<span class="token punctuation">)</span><span class="token punctuation">)</span></pre></td></tr></table></figure><figure class="highlight text"><figcaption data-lang="text"></figcaption><table><tr><td data-num="1"></td><td><pre>## F1.S0001 F1.S0002 F1.S0003 F1.S0004 F1.S0005 F1.S0006 </pre></td></tr><tr><td data-num="2"></td><td><pre>## 2501.378 2502.943 2504.508 2506.073 2507.638 2509.203</pre></td></tr></table></figure><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>head<span class="token punctuation">(</span>intensity<span class="token punctuation">(</span>bpi_1<span class="token punctuation">)</span><span class="token punctuation">)</span></pre></td></tr></table></figure><figure class="highlight text"><figcaption data-lang="text"></figcaption><table><tr><td data-num="1"></td><td><pre>## F1.S0001 F1.S0002 F1.S0003 F1.S0004 F1.S0005 F1.S0006 </pre></td></tr><tr><td data-num="2"></td><td><pre>##   43888    43960    43392    42632    42200    42288</pre></td></tr></table></figure><p><code>chromatogram</code> 法还支持从 MS 数据的 m/z-rt 切片中提取 chromatographic 数据。在下一节中，我们将使用此方法为选定的峰创建提取的离子色谱图（extracted ion chromatogram, EIC）。</p><p>注意， <code>chromatogram</code> 从每个文件读取原始数据以计算 chromatogram。另一方面， <code>bpi</code> 和 <code>tic</code> 方法不从原始文件读取任何数据，而是使用输入文件的头定义 (header definition) 中提供的相应信息（可能与实际数据不同）。</p><p>下面我们创建表示每个文件总离子流分布的箱线图。这些图对于发现有问题或失败的 MS 运行非常有用。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre><span class="token comment">## Get the total ion current by file</span></pre></td></tr><tr><td data-num="2"></td><td><pre>tc <span class="token operator">&lt;-</span> split<span class="token punctuation">(</span>tic<span class="token punctuation">(</span>raw_data<span class="token punctuation">)</span><span class="token punctuation">,</span> f <span class="token operator">=</span> fromFile<span class="token punctuation">(</span>raw_data<span class="token punctuation">)</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="3"></td><td><pre>boxplot<span class="token punctuation">(</span>tc<span class="token punctuation">,</span> col <span class="token operator">=</span> group_colors<span class="token punctuation">[</span>raw_data<span class="token operator">$</span>sample_group<span class="token punctuation">]</span><span class="token punctuation">,</span></pre></td></tr><tr><td data-num="4"></td><td><pre>        ylab <span class="token operator">=</span> <span class="token string">"intensity"</span><span class="token punctuation">,</span> main <span class="token operator">=</span> <span class="token string">"Total ion current"</span><span class="token punctuation">)</span></pre></td></tr></table></figure><p><img data-src="https://fastly.jsdelivr.net/gh/liaochenlanruo/cdn@master/img/custom/metabolomics/xcms_2.png" alt="Distribution of total ion currents per file"></p><p>此外，我们可以根据样品的 BPC 的相似性对样品进行聚类。这也有助于在实验中发现潜在的有问题的样本，或获得实验中样本分组的初步概述。由于样本之间的保留时间不完全相同，我们使用 <code>bin</code> 函数将强度分组在沿保留时间轴的固定时间范围（bins）中。在本示例中，我们使用的 bin 大小为 2 秒，默认值为 0.5 秒。聚类是使用完全连锁分级聚类（complete linkage hierarchical clustering）对合并的 BPC 的成对相关性进行的。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre><span class="token comment">## Bin the BPC</span></pre></td></tr><tr><td data-num="2"></td><td><pre>bpis_bin <span class="token operator">&lt;-</span> MSnbase<span class="token operator">::</span>bin<span class="token punctuation">(</span>bpis<span class="token punctuation">,</span> binSize <span class="token operator">=</span> <span class="token number">2</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="3"></td><td><pre></pre></td></tr><tr><td data-num="4"></td><td><pre><span class="token comment">## Calculate correlation on the log2 transformed base peak intensities</span></pre></td></tr><tr><td data-num="5"></td><td><pre>cormat <span class="token operator">&lt;-</span> cor<span class="token punctuation">(</span>log2<span class="token punctuation">(</span>do.call<span class="token punctuation">(</span>cbind<span class="token punctuation">,</span> lapply<span class="token punctuation">(</span>bpis_bin<span class="token punctuation">,</span> intensity<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="6"></td><td><pre>colnames<span class="token punctuation">(</span>cormat<span class="token punctuation">)</span> <span class="token operator">&lt;-</span> rownames<span class="token punctuation">(</span>cormat<span class="token punctuation">)</span> <span class="token operator">&lt;-</span> raw_data<span class="token operator">$</span>sample_name</pre></td></tr><tr><td data-num="7"></td><td><pre></pre></td></tr><tr><td data-num="8"></td><td><pre><span class="token comment">## Define which phenodata columns should be highlighted in the plot</span></pre></td></tr><tr><td data-num="9"></td><td><pre>ann <span class="token operator">&lt;-</span> data.frame<span class="token punctuation">(</span>group <span class="token operator">=</span> raw_data<span class="token operator">$</span>sample_group<span class="token punctuation">)</span></pre></td></tr><tr><td data-num="10"></td><td><pre>rownames<span class="token punctuation">(</span>ann<span class="token punctuation">)</span> <span class="token operator">&lt;-</span> raw_data<span class="token operator">$</span>sample_name</pre></td></tr><tr><td data-num="11"></td><td><pre></pre></td></tr><tr><td data-num="12"></td><td><pre><span class="token comment">## Perform the cluster analysis</span></pre></td></tr><tr><td data-num="13"></td><td><pre>pheatmap<span class="token punctuation">(</span>cormat<span class="token punctuation">,</span> annotation <span class="token operator">=</span> ann<span class="token punctuation">,</span> annotation_color <span class="token operator">=</span> list<span class="token punctuation">(</span>group <span class="token operator">=</span> group_colors<span class="token punctuation">)</span><span class="token punctuation">)</span></pre></td></tr></table></figure><p><img data-src="https://fastly.jsdelivr.net/gh/liaochenlanruo/cdn@master/img/custom/metabolomics/xcms_3.png" alt="Grouping of samples based on similarity of their base peak chromatogram"></p><p>样本以成对方式聚类，样本索引的 KO 和 WT 样本具有最相似的 BPC。</p><h1 id="色谱峰检测"><a class="anchor" href="#色谱峰检测">#</a> 色谱峰检测</h1><p>接下来，我们使用 <code>centWave</code> 算法进行色谱峰检测 [2]。然而，在运行峰值检测之前，强烈建议目视检查内参或已知化合物的提取离子色谱图，以评估和调整峰值检测设置，因为默认设置不适用于大多数 LCMS 实验。centWave 的两个最关键的参数是 <code>peakwidth</code> （色谱峰宽度的预期范围）和 <code>ppm</code> （对应于一个色谱峰的 centroids m/z 值的最大预期偏差；这通常比制造商规定的 ppm 大得多）参数。为了评估典型的色谱峰宽度，我们绘制了一个峰的 EIC。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre><span class="token comment">## Define the rt and m/z range of the peak area</span></pre></td></tr><tr><td data-num="2"></td><td><pre>rtr <span class="token operator">&lt;-</span> c<span class="token punctuation">(</span><span class="token number">2700</span><span class="token punctuation">,</span> <span class="token number">2900</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="3"></td><td><pre>mzr <span class="token operator">&lt;-</span> c<span class="token punctuation">(</span><span class="token number">334.9</span><span class="token punctuation">,</span> <span class="token number">335.1</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="4"></td><td><pre><span class="token comment">## extract the chromatogram</span></pre></td></tr><tr><td data-num="5"></td><td><pre>chr_raw <span class="token operator">&lt;-</span> chromatogram<span class="token punctuation">(</span>raw_data<span class="token punctuation">,</span> mz <span class="token operator">=</span> mzr<span class="token punctuation">,</span> rt <span class="token operator">=</span> rtr<span class="token punctuation">)</span></pre></td></tr><tr><td data-num="6"></td><td><pre>plot<span class="token punctuation">(</span>chr_raw<span class="token punctuation">,</span> col <span class="token operator">=</span> group_colors<span class="token punctuation">[</span>chr_raw<span class="token operator">$</span>sample_group<span class="token punctuation">]</span><span class="token punctuation">)</span></pre></td></tr></table></figure><p><img data-src="https://fastly.jsdelivr.net/gh/liaochenlanruo/cdn@master/img/custom/metabolomics/xcms_4.png" alt="Extracted ion chromatogram for one peak"></p><p>注意，如果在特定扫描（即特定保留时间）中，在各自的 mz 范围内没有测量到信号，则通过 <code>chromatogram</code> 法提取的 Chromatogram 对象包含 <code>NA值</code> 。反映在上图中为不连续的线。</p><p>上面的峰值宽度约为 50 秒。 <code>peakwidth</code> 参数应设置为适应数据集中预期的峰值宽度。对于当前示例数据集，我们将其设置为 <code>20,80</code> 。</p><p>对于 <code>ppm</code> 参数，我们提取对应于上述峰值的完整 MS 数据（强度、保留时间和 m/z 值）。为此，我们首先按保留时间过滤原始对象，然后按 m/z 过滤，最后用 <code>type=“XIC”</code> 绘制对象以生成下图。我们使用 pipe（ <code>%&gt;%</code> ）命令更好地说明了相应的工作流。还应注意，在这种类型的图中，如果存在色谱峰，则默认显示色谱峰。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>raw_data <span class="token percent-operator operator">%>%</span></pre></td></tr><tr><td data-num="2"></td><td><pre>    filterRt<span class="token punctuation">(</span>rt <span class="token operator">=</span> rtr<span class="token punctuation">)</span> <span class="token percent-operator operator">%>%</span></pre></td></tr><tr><td data-num="3"></td><td><pre>    filterMz<span class="token punctuation">(</span>mz <span class="token operator">=</span> mzr<span class="token punctuation">)</span> <span class="token percent-operator operator">%>%</span></pre></td></tr><tr><td data-num="4"></td><td><pre>    plot<span class="token punctuation">(</span>type <span class="token operator">=</span> <span class="token string">"XIC"</span><span class="token punctuation">)</span></pre></td></tr></table></figure><p><img data-src="https://fastly.jsdelivr.net/gh/liaochenlanruo/cdn@master/img/custom/metabolomics/xcms_5.png" alt="Visualization of the raw MS data for one peak"></p><p><strong>图注</strong>：对于每个图：上面板：根据保留时间绘制强度值的色谱图；下面板：m/z 根据保留时间绘图。各个数据点根据强度进行着色。</p><p>在目前的数据中，m/z 值实际上没有变化。通常可以看到 m/z 值（下面板）散布在化合物的实际 m/z 值周围。centWave 算法的第一步基于连续扫描的 m/z 值的差异定义所谓的感兴趣区域（regions of interest, ROI）。具体而言，如果 ROI 的 m/z 和平均 m/z 之间的差小于用户定义的 ppm 参数，则来自连续扫描的 m/z 值被包括在 ROI 中。因此，ppm 的合理选择可以是来自作为色谱峰一部分的相邻扫描 / 光谱（scans/spectra）的数据点的最大 m/z 差。建议检查许多化合物（内标或样品中已知存在的化合物）的 m/z 值范围，并根据这些确定 centWave 的 ppm 参数。</p><p>注意，我们也可以对提取的离子色谱图（ion chromatogram）进行峰检测。这有助于评估不同的峰值检测设置。只需注意，提取的离子色谱图上的峰值检测不会考虑 ppm 参数，并且背景信号的估计与完整数据集上的峰值探测不同；因此， <code>snthresh</code> 的值将具有不同的结果。下面我们使用 <code>findChromPeaks</code> 函数对提取的离子色谱图进行峰值检测。提交的参数对象定义将使用的算法，并允许定义此算法的设置。我们使用带有默认设置的 centWave 算法， <code>snthresh</code> 除外。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>xchr <span class="token operator">&lt;-</span> findChromPeaks<span class="token punctuation">(</span>chr_raw<span class="token punctuation">,</span> param <span class="token operator">=</span> CentWaveParam<span class="token punctuation">(</span>snthresh <span class="token operator">=</span> <span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">)</span></pre></td></tr></table></figure><p>我们可以使用 <code>chromPeaks</code> 函数访问已识别的色谱峰。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>head<span class="token punctuation">(</span>chromPeaks<span class="token punctuation">(</span>xchr<span class="token punctuation">)</span><span class="token punctuation">)</span></pre></td></tr></table></figure><figure class="highlight text"><figcaption data-lang="text"></figcaption><table><tr><td data-num="1"></td><td><pre>##            rt    rtmin    rtmax       into       intb  maxo  sn row column</pre></td></tr><tr><td data-num="2"></td><td><pre>## [1,] 2781.505 2761.160 2809.674  412134.25  355516.37 16856  13   1      1</pre></td></tr><tr><td data-num="3"></td><td><pre>## [2,] 2786.199 2764.290 2812.803 1496244.21 1391821.33 58736  20   1      2</pre></td></tr><tr><td data-num="4"></td><td><pre>## [3,] 2734.556 2714.211 2765.855   21579.37   18449.43   899   4   1      3</pre></td></tr><tr><td data-num="5"></td><td><pre>## [4,] 2797.154 2775.245 2815.933  159058.78  150289.31  6295  12   1      3</pre></td></tr><tr><td data-num="6"></td><td><pre>## [5,] 2784.635 2761.160 2808.109   54947.54   37923.53  2715   2   1      4</pre></td></tr><tr><td data-num="7"></td><td><pre>## [6,] 2859.752 2845.668 2878.532   13895.21   13874.87   905 904   1      4</pre></td></tr></table></figure><p>与 <code>chromPeaks</code> 矩阵相似，还有一个数据框 <code>chromPeakData</code> ，允许为每个色谱峰添加任意注释。下面我们提取这个数据框，默认情况下，该数据框只包含识别峰值的 MS 水平。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>chromPeakData<span class="token punctuation">(</span>xchr<span class="token punctuation">)</span></pre></td></tr></table></figure><figure class="highlight text"><figcaption data-lang="text"></figcaption><table><tr><td data-num="1"></td><td><pre>## DataFrame with 12 rows and 4 columns</pre></td></tr><tr><td data-num="2"></td><td><pre>##      ms_level is_filled       row    column</pre></td></tr><tr><td data-num="3"></td><td><pre>##     &lt;integer> &lt;logical> &lt;integer> &lt;integer></pre></td></tr><tr><td data-num="4"></td><td><pre>## 1           1     FALSE         1         1</pre></td></tr><tr><td data-num="5"></td><td><pre>## 2           1     FALSE         1         2</pre></td></tr><tr><td data-num="6"></td><td><pre>## 3           1     FALSE         1         3</pre></td></tr><tr><td data-num="7"></td><td><pre>## 4           1     FALSE         1         3</pre></td></tr><tr><td data-num="8"></td><td><pre>## 5           1     FALSE         1         4</pre></td></tr><tr><td data-num="9"></td><td><pre>## ...       ...       ...       ...       ...</pre></td></tr><tr><td data-num="10"></td><td><pre>## 8           1     FALSE         1         4</pre></td></tr><tr><td data-num="11"></td><td><pre>## 9           1     FALSE         1         5</pre></td></tr><tr><td data-num="12"></td><td><pre>## 10          1     FALSE         1         6</pre></td></tr><tr><td data-num="13"></td><td><pre>## 11          1     FALSE         1         7</pre></td></tr><tr><td data-num="14"></td><td><pre>## 12          1     FALSE         1         8</pre></td></tr></table></figure><p>接下来，我们在提取的离子色谱图中绘制已识别的色谱峰。我们使用 <code>col</code> 参数为各个色谱线上色。还可以为识别的峰值指定颜色， <code>peakCol</code> 为前景 / 边框颜色， <code>peakBg</code> 为背景 / 填充颜色。必须为 <code>chromPeaks</code> 列出的每个色谱峰提供一种颜色。下面我们定义了一种颜色，以指示样本所在的样本组，并使用峰 <code>“sample”</code> 列中的样本信息为每个色谱峰分配正确的颜色。更多峰值突出显示选项将在下面进一步描述。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>sample_colors <span class="token operator">&lt;-</span> group_colors<span class="token punctuation">[</span>xchr<span class="token operator">$</span>sample_group<span class="token punctuation">]</span></pre></td></tr><tr><td data-num="2"></td><td><pre>plot<span class="token punctuation">(</span>xchr<span class="token punctuation">,</span> col <span class="token operator">=</span> sample_colors<span class="token punctuation">,</span></pre></td></tr><tr><td data-num="3"></td><td><pre>     peakBg <span class="token operator">=</span> sample_colors<span class="token punctuation">[</span>chromPeaks<span class="token punctuation">(</span>xchr<span class="token punctuation">)</span><span class="token punctuation">[</span><span class="token punctuation">,</span> <span class="token string">"column"</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">)</span></pre></td></tr></table></figure><p><img data-src="https://fastly.jsdelivr.net/gh/liaochenlanruo/cdn@master/img/custom/metabolomics/xcms_6.png" alt="Signal for an example peak"></p><p><strong>图注</strong>：红色和蓝色分别代表 KO 和野生型样本。已识别色谱峰的峰面积用样品组颜色突出显示。</p><p>最后，我们对整个数据集进行色谱峰检测。请注意，我们将参数 <code>prefilter</code> 设置为 <code>c(6, 5000)</code> ，将 <code>noise</code> 设置为 <code>5000</code> ，以减少该示例的运行时间。使用此设置，我们只考虑峰值检测步骤中值大于 5000 的信号。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>cwp <span class="token operator">&lt;-</span> CentWaveParam<span class="token punctuation">(</span>peakwidth <span class="token operator">=</span> c<span class="token punctuation">(</span><span class="token number">20</span><span class="token punctuation">,</span> <span class="token number">80</span><span class="token punctuation">)</span><span class="token punctuation">,</span> noise <span class="token operator">=</span> <span class="token number">5000</span><span class="token punctuation">,</span></pre></td></tr><tr><td data-num="2"></td><td><pre>                     prefilter <span class="token operator">=</span> c<span class="token punctuation">(</span><span class="token number">6</span><span class="token punctuation">,</span> <span class="token number">5000</span><span class="token punctuation">)</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="3"></td><td><pre>xdata <span class="token operator">&lt;-</span> findChromPeaks<span class="token punctuation">(</span>raw_data<span class="token punctuation">,</span> param <span class="token operator">=</span> cwp<span class="token punctuation">)</span></pre></td></tr></table></figure><p>结果作为 <code>XCMSnExp</code> 对象返回，该对象通过存储 LC/GC-MS 预处理结果来扩展 <code>OnDiskMSnExp</code> 对象。这也意味着，所有设置和过滤数据或访问（原始）数据的方法都是从 <code>OnDiskMSnExp</code> 对象继承的，因此可以重新使用。还请注意，通过使用参数 <code>add＝TRUE</code> 调用 <code>findChromPeaks</code> ，可以对 <code>xdata</code> 对象执行额外的峰值检测（例如，在 MS level＞1 的数据上）。</p><p>色谱峰检测的结果可通过 <code>chromPeaks</code> 方法获得。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>head<span class="token punctuation">(</span>chromPeaks<span class="token punctuation">(</span>xdata<span class="token punctuation">)</span><span class="token punctuation">)</span></pre></td></tr></table></figure><figure class="highlight text"><figcaption data-lang="text"></figcaption><table><tr><td data-num="1"></td><td><pre>##           mz mzmin mzmax       rt    rtmin    rtmax      into      intb  maxo    sn sample</pre></td></tr><tr><td data-num="2"></td><td><pre>## CP0001 453.2 453.2 453.2 2509.203 2501.378 2527.982 1007409.0 1007380.8 38152 38151      1</pre></td></tr><tr><td data-num="3"></td><td><pre>## CP0002 236.1 236.1 236.1 2518.593 2501.378 2537.372  253501.0  226896.3 12957    11      1</pre></td></tr><tr><td data-num="4"></td><td><pre>## CP0003 594.0 594.0 594.0 2601.535 2581.191 2637.529  161042.2  149297.3  7850    13      1</pre></td></tr><tr><td data-num="5"></td><td><pre>## CP0004 577.0 577.0 577.0 2604.665 2581.191 2626.574  136105.2  129195.5  6215    13      1</pre></td></tr><tr><td data-num="6"></td><td><pre>## CP0005 369.2 369.2 369.2 2587.451 2556.151 2631.269  483852.3  483777.1  7215  7214      1</pre></td></tr><tr><td data-num="7"></td><td><pre>## CP0006 369.2 369.2 369.2 2568.671 2557.716 2578.061  144624.8  144602.9  7033  7032      1</pre></td></tr></table></figure><p>返回的 <code>matrix</code> 提供了每个已识别色谱峰的 m/z 和保留时间范围，以及整合的信号强度（“into”）和最大峰强度（“maxo”）。“sample” 列包含确定峰值的对象 / 实验中样本的索引。</p><p>可以使用 <code>chromPeakData</code> 函数提取每个峰的注释。该数据框还可以用于为每个检测到的峰添加 / 存储任意注释。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>chromPeakData<span class="token punctuation">(</span>xdata<span class="token punctuation">)</span></pre></td></tr></table></figure><figure class="highlight text"><figcaption data-lang="text"></figcaption><table><tr><td data-num="1"></td><td><pre>## DataFrame with 1707 rows and 2 columns</pre></td></tr><tr><td data-num="2"></td><td><pre>##         ms_level is_filled</pre></td></tr><tr><td data-num="3"></td><td><pre>##        &lt;integer> &lt;logical></pre></td></tr><tr><td data-num="4"></td><td><pre>## CP0001         1     FALSE</pre></td></tr><tr><td data-num="5"></td><td><pre>## CP0002         1     FALSE</pre></td></tr><tr><td data-num="6"></td><td><pre>## CP0003         1     FALSE</pre></td></tr><tr><td data-num="7"></td><td><pre>## CP0004         1     FALSE</pre></td></tr><tr><td data-num="8"></td><td><pre>## CP0005         1     FALSE</pre></td></tr><tr><td data-num="9"></td><td><pre>## ...          ...       ...</pre></td></tr><tr><td data-num="10"></td><td><pre>## CP1703         1     FALSE</pre></td></tr><tr><td data-num="11"></td><td><pre>## CP1704         1     FALSE</pre></td></tr><tr><td data-num="12"></td><td><pre>## CP1705         1     FALSE</pre></td></tr><tr><td data-num="13"></td><td><pre>## CP1706         1     FALSE</pre></td></tr><tr><td data-num="14"></td><td><pre>## CP1707         1     FALSE</pre></td></tr></table></figure><p>峰检测不会总是完美地工作，从而导致峰检测伪影（artifacts），例如重叠峰或人为分割峰。 <code>refineChromPeaks</code> 函数允许通过去除未通过特定标准的已识别峰或合并人工拆分的色谱峰来优化峰检测结果。使用参数对象 <code>CleanPeaksParam</code> 和 <code>FilterIntensityParam</code> ，可以分别删除保留时间范围或强度低于阈值的峰（有关更多详细信息和示例，请参阅各自的帮助页面）。使用 <code>MergeNeighbringPeaksParam</code> 可以合并色谱峰。下面我们对峰检测结果进行进一步处理，如果它们之间的信号低于较小峰最大强度的 75%，合并每个文件在 4 秒窗口中重叠的峰值（merging peaks overlapping in a 4 second window per file）。有关设置和方法的详细说明，请参阅 <code>MergeNeighborgingPeaksParam</code> 帮助页面。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>mpp <span class="token operator">&lt;-</span> MergeNeighboringPeaksParam<span class="token punctuation">(</span>expandRt <span class="token operator">=</span> <span class="token number">4</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="2"></td><td><pre>xdata_pp <span class="token operator">&lt;-</span> refineChromPeaks<span class="token punctuation">(</span>xdata<span class="token punctuation">,</span> mpp<span class="token punctuation">)</span></pre></td></tr></table></figure><p>如下展示了合并峰的示例。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>mzr_1 <span class="token operator">&lt;-</span> <span class="token number">305.1</span> <span class="token operator">+</span> c<span class="token punctuation">(</span><span class="token operator">-</span><span class="token number">0.01</span><span class="token punctuation">,</span> <span class="token number">0.01</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="2"></td><td><pre>chr_1 <span class="token operator">&lt;-</span> chromatogram<span class="token punctuation">(</span>filterFile<span class="token punctuation">(</span>xdata<span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">,</span> mz <span class="token operator">=</span> mzr_1<span class="token punctuation">)</span></pre></td></tr><tr><td data-num="3"></td><td><pre>chr_2 <span class="token operator">&lt;-</span> chromatogram<span class="token punctuation">(</span>filterFile<span class="token punctuation">(</span>xdata_pp<span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">,</span> mz <span class="token operator">=</span> mzr_1<span class="token punctuation">)</span></pre></td></tr><tr><td data-num="4"></td><td><pre>par<span class="token punctuation">(</span>mfrow <span class="token operator">=</span> c<span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="5"></td><td><pre>png<span class="token punctuation">(</span>file<span class="token operator">=</span><span class="token string">"xcms_7.png"</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="6"></td><td><pre>plot<span class="token punctuation">(</span>chr_1<span class="token punctuation">)</span></pre></td></tr><tr><td data-num="7"></td><td><pre>dev.off<span class="token punctuation">(</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="8"></td><td><pre>png<span class="token punctuation">(</span>file<span class="token operator">=</span><span class="token string">"xcms_8.png"</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="9"></td><td><pre>plot<span class="token punctuation">(</span>chr_2<span class="token punctuation">)</span></pre></td></tr><tr><td data-num="10"></td><td><pre>dev.off<span class="token punctuation">(</span><span class="token punctuation">)</span></pre></td></tr></table></figure><table align="center"><tr><td align="center"><img data-src="https://fastly.jsdelivr.net/gh/liaochenlanruo/cdn@master/img/custom/metabolomics/xcms_7.png" alt="Result from the peak refinement step: 处理前的数据" style="width:300px;height:300px;vertical-align:-20px;border-radius:0;margin-right:0;margin-bottom:5px;align:center"></td><td align="center"><img data-src="https://fastly.jsdelivr.net/gh/liaochenlanruo/cdn@master/img/custom/metabolomics/xcms_8.png" alt="Result from the peak refinement step: 处理后的数据，峰被合并" style="width:300px;height:300px;vertical-align:-20px;border-radius:0;margin-left:0;margin-bottom:5px;align:center"></td></tr></table><p>对于以上色谱图 centWave 检测到 3 个峰（1 个峰代表整个区域，两个较小的峰，见上图中的左侧面板）。 <code>MergeNeighborgingPeaksParam</code> 的峰细化（refinement ）将它们减少为单个峰（上图中的右面板）。注意，这种细化不会合并相邻峰值，因为它们之间的信号低于一定比例（参见下图）。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>mzr_1 <span class="token operator">&lt;-</span> <span class="token number">496.2</span> <span class="token operator">+</span> c<span class="token punctuation">(</span><span class="token operator">-</span><span class="token number">0.01</span><span class="token punctuation">,</span> <span class="token number">0.01</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="2"></td><td><pre>chr_1 <span class="token operator">&lt;-</span> chromatogram<span class="token punctuation">(</span>filterFile<span class="token punctuation">(</span>xdata<span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">,</span> mz <span class="token operator">=</span> mzr_1<span class="token punctuation">)</span></pre></td></tr><tr><td data-num="3"></td><td><pre>chr_2 <span class="token operator">&lt;-</span> chromatogram<span class="token punctuation">(</span>filterFile<span class="token punctuation">(</span>xdata_pp<span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">,</span> mz <span class="token operator">=</span> mzr_1<span class="token punctuation">)</span></pre></td></tr><tr><td data-num="4"></td><td><pre>par<span class="token punctuation">(</span>mfrow <span class="token operator">=</span> c<span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="5"></td><td><pre>png<span class="token punctuation">(</span>file<span class="token operator">=</span><span class="token string">"xcms_9.png"</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="6"></td><td><pre>plot<span class="token punctuation">(</span>chr_1<span class="token punctuation">)</span></pre></td></tr><tr><td data-num="7"></td><td><pre>dev.off<span class="token punctuation">(</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="8"></td><td><pre>png<span class="token punctuation">(</span>file<span class="token operator">=</span><span class="token string">"xcms_10.png"</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="9"></td><td><pre>plot<span class="token punctuation">(</span>chr_2<span class="token punctuation">)</span></pre></td></tr><tr><td data-num="10"></td><td><pre>dev.off<span class="token punctuation">(</span><span class="token punctuation">)</span></pre></td></tr></table></figure><table align="center"><tr><td align="center"><img data-src="https://fastly.jsdelivr.net/gh/liaochenlanruo/cdn@master/img/custom/metabolomics/xcms_9.png" alt="Result from the peak refinement step: 处理前的数据" style="width:300px;height:300px;vertical-align:-20px;border-radius:0;margin-right:0;margin-bottom:5px;align:center"></td><td align="center"><img data-src="https://fastly.jsdelivr.net/gh/liaochenlanruo/cdn@master/img/custom/metabolomics/xcms_10.png" alt="Result from the peak refinement step: 处理后的数据，峰未合并" style="width:300px;height:300px;vertical-align:-20px;border-radius:0;margin-left:0;margin-bottom:5px;align:center"></td></tr></table><p>还应注意，可以对提取的离子色谱图进行峰细化。这可以例如用于微调参数的设置。为了说明这一点，我们下面对提取的离子色谱图 <code>chr_1</code> 进行了峰细化，减少了 <code>minProp</code> 参数，以强制连接两个峰。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>res <span class="token operator">&lt;-</span> refineChromPeaks<span class="token punctuation">(</span>chr_1<span class="token punctuation">,</span> MergeNeighboringPeaksParam<span class="token punctuation">(</span>minProp <span class="token operator">=</span> <span class="token number">0.05</span><span class="token punctuation">)</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="2"></td><td><pre>chromPeaks<span class="token punctuation">(</span>res<span class="token punctuation">)</span></pre></td></tr></table></figure><figure class="highlight text"><figcaption data-lang="text"></figcaption><table><tr><td data-num="1"></td><td><pre>##         mz mzmin mzmax       rt    rtmin    rtmax     into intb    maxo  sn</pre></td></tr><tr><td data-num="2"></td><td><pre>## CPM1 496.2 496.2 496.2 3384.012 3294.809 3412.181 45940118   NA 1128960 177</pre></td></tr><tr><td data-num="3"></td><td><pre>##      sample row column</pre></td></tr><tr><td data-num="4"></td><td><pre>## CPM1      1   1      1</pre></td></tr></table></figure><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>png<span class="token punctuation">(</span>file<span class="token operator">=</span><span class="token string">"cxms_11.png"</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="2"></td><td><pre>plot<span class="token punctuation">(</span>res<span class="token punctuation">)</span></pre></td></tr><tr><td data-num="3"></td><td><pre>dev.off<span class="token punctuation">(</span><span class="token punctuation">)</span></pre></td></tr></table></figure><p><img data-src="https://fastly.jsdelivr.net/gh/liaochenlanruo/cdn@master/img/custom/metabolomics/xcms_11.png" alt="强制连接两个峰"></p><p>在继续之前，我们用峰细化的结果替换 <code>xdata</code> 对象。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>xdata <span class="token operator">&lt;-</span> xdata_pp</pre></td></tr></table></figure><p>下面我们使用 <code>chromPeaks</code> 矩阵中的数据来计算每个文件的一些摘要。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>summary_fun <span class="token operator">&lt;-</span> <span class="token keyword">function</span><span class="token punctuation">(</span>z<span class="token punctuation">)</span></pre></td></tr><tr><td data-num="2"></td><td><pre>    c<span class="token punctuation">(</span>peak_count <span class="token operator">=</span> nrow<span class="token punctuation">(</span>z<span class="token punctuation">)</span><span class="token punctuation">,</span> rt <span class="token operator">=</span> quantile<span class="token punctuation">(</span>z<span class="token punctuation">[</span><span class="token punctuation">,</span> <span class="token string">"rtmax"</span><span class="token punctuation">]</span> <span class="token operator">-</span> z<span class="token punctuation">[</span><span class="token punctuation">,</span> <span class="token string">"rtmin"</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="3"></td><td><pre></pre></td></tr><tr><td data-num="4"></td><td><pre>T <span class="token operator">&lt;-</span> lapply<span class="token punctuation">(</span>split.data.frame<span class="token punctuation">(</span>chromPeaks<span class="token punctuation">(</span>xdata<span class="token punctuation">)</span><span class="token punctuation">,</span> f <span class="token operator">=</span> chromPeaks<span class="token punctuation">(</span>xdata<span class="token punctuation">)</span><span class="token punctuation">[</span><span class="token punctuation">,</span> <span class="token string">"sample"</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">,</span> FUN <span class="token operator">=</span> summary_fun<span class="token punctuation">)</span></pre></td></tr><tr><td data-num="5"></td><td><pre></pre></td></tr><tr><td data-num="6"></td><td><pre>T <span class="token operator">&lt;-</span> do.call<span class="token punctuation">(</span>rbind<span class="token punctuation">,</span> T<span class="token punctuation">)</span></pre></td></tr><tr><td data-num="7"></td><td><pre></pre></td></tr><tr><td data-num="8"></td><td><pre>rownames<span class="token punctuation">(</span>T<span class="token punctuation">)</span> <span class="token operator">&lt;-</span> basename<span class="token punctuation">(</span>fileNames<span class="token punctuation">(</span>xdata<span class="token punctuation">)</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="9"></td><td><pre></pre></td></tr><tr><td data-num="10"></td><td><pre>pandoc.table<span class="token punctuation">(</span>T<span class="token punctuation">,</span> caption <span class="token operator">=</span> paste0<span class="token punctuation">(</span><span class="token string">"Summary statistics on identified chromatographic"</span><span class="token punctuation">,</span> <span class="token string">" peaks. Shown are number of identified peaks per"</span><span class="token punctuation">,</span> <span class="token string">" sample and widths/duration of chromatographic "</span><span class="token punctuation">,</span> <span class="token string">"peaks."</span><span class="token punctuation">)</span><span class="token punctuation">)</span></pre></td></tr></table></figure><figure class="highlight text"><figcaption data-lang="text"></figcaption><table><tr><td data-num="1"></td><td><pre>------------------------------------------------------------------------</pre></td></tr><tr><td data-num="2"></td><td><pre>    &amp;nbsp;      peak_count   rt.0%   rt.25%   rt.50%   rt.75%   rt.100%</pre></td></tr><tr><td data-num="3"></td><td><pre>-------------- ------------ ------- -------- -------- -------- ---------</pre></td></tr><tr><td data-num="4"></td><td><pre> **ko15.CDF**      400       10.95   34.43    42.25    53.21     319.2</pre></td></tr><tr><td data-num="5"></td><td><pre></pre></td></tr><tr><td data-num="6"></td><td><pre> **ko16.CDF**      522       10.95   32.86    42.25    53.21     151.8</pre></td></tr><tr><td data-num="7"></td><td><pre></pre></td></tr><tr><td data-num="8"></td><td><pre> **ko21.CDF**      215       10.95   42.25    50.08    64.95     164.3</pre></td></tr><tr><td data-num="9"></td><td><pre></pre></td></tr><tr><td data-num="10"></td><td><pre> **ko22.CDF**      239       10.95   37.56    46.95    59.47     147.1</pre></td></tr><tr><td data-num="11"></td><td><pre></pre></td></tr><tr><td data-num="12"></td><td><pre> **wt15.CDF**      408       10.95    31.3    42.25    53.21     161.2</pre></td></tr><tr><td data-num="13"></td><td><pre></pre></td></tr><tr><td data-num="14"></td><td><pre> **wt16.CDF**      366       10.95   35.99    45.38    59.47     162.8</pre></td></tr><tr><td data-num="15"></td><td><pre></pre></td></tr><tr><td data-num="16"></td><td><pre> **wt21.CDF**      228       10.95   35.99    48.51    65.73     172.1</pre></td></tr><tr><td data-num="17"></td><td><pre></pre></td></tr><tr><td data-num="18"></td><td><pre> **wt22.CDF**      334       10.95   35.99    43.82     57.9     228.5</pre></td></tr><tr><td data-num="19"></td><td><pre>------------------------------------------------------------------------</pre></td></tr><tr><td data-num="20"></td><td><pre></pre></td></tr><tr><td data-num="21"></td><td><pre>Table: Summary statistics on identified chromatographic peaks. Shown are number of identified peaks per sample and widths/duration of chromatographic peaks.</pre></td></tr></table></figure><p>我们还可以使用 <code>plotChromPeaks</code> 函数绘制一个文件的 m/z—— 保留时间空间中已识别色谱峰的位置。下面我们绘制了第三个样品的色谱峰。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>png<span class="token punctuation">(</span>file<span class="token operator">=</span><span class="token string">"xcms_12.png"</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="2"></td><td><pre>plotChromPeaks<span class="token punctuation">(</span>xdata<span class="token punctuation">,</span> file <span class="token operator">=</span> <span class="token number">3</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="3"></td><td><pre>dev.off<span class="token punctuation">(</span><span class="token punctuation">)</span></pre></td></tr></table></figure><p><img data-src="https://fastly.jsdelivr.net/gh/liaochenlanruo/cdn@master/img/custom/metabolomics/xcms_12.png" alt="Identified chromatographic peaks in the m/z by retention time space for one sample"></p><p>为了获得峰检测的全局概览，我们可以沿着保留时间轴绘制每个文件的已识别峰的频率。这允许识别 MS 运行中的时间段，在该时间段中识别出更多数量的峰，并评估这在文件之间是否一致。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>png<span class="token punctuation">(</span>file<span class="token operator">=</span><span class="token string">"xcms_13.png"</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="2"></td><td><pre>plotChromPeakImage<span class="token punctuation">(</span>xdata<span class="token punctuation">)</span></pre></td></tr><tr><td data-num="3"></td><td><pre>dev.off<span class="token punctuation">(</span><span class="token punctuation">)</span></pre></td></tr></table></figure><p><img data-src="https://fastly.jsdelivr.net/gh/liaochenlanruo/cdn@master/img/custom/metabolomics/xcms_13.png" alt="Frequency of identified chromatographic peaks along the retention time axis"></p><p><strong>图注</strong>：频率是彩色编码的，较高的频率由黄 - 白表示。每行显示一个文件的峰值频率。</p><p>接下来，我们重点介绍前面示例峰的已识别色谱峰。在对应于已知峰或内标的峰列表上评估这样的图有助于确保峰检测设置是适当的并且正确地识别预期峰。我们从峰检测结果对象中提取离子色谱图，其中还包含我们可以使用 <code>chromPeaks</code> 函数提取的该离子的已识别色谱峰。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>chr_ex <span class="token operator">&lt;-</span> chromatogram<span class="token punctuation">(</span>xdata<span class="token punctuation">,</span> mz <span class="token operator">=</span> mzr<span class="token punctuation">,</span> rt <span class="token operator">=</span> rtr<span class="token punctuation">)</span></pre></td></tr><tr><td data-num="2"></td><td><pre>chromPeaks<span class="token punctuation">(</span>chr_ex<span class="token punctuation">)</span></pre></td></tr></table></figure><figure class="highlight text"><figcaption data-lang="text"></figcaption><table><tr><td data-num="1"></td><td><pre>##         mz mzmin mzmax       rt    rtmin    rtmax      into      intb  maxo sn</pre></td></tr><tr><td data-num="2"></td><td><pre>## CP0045 335   335   335 2781.505 2761.160 2809.674  412134.3  383167.4 16856 23</pre></td></tr><tr><td data-num="3"></td><td><pre>## CP0501 335   335   335 2786.199 2764.290 2812.803 1496244.2 1461187.3 58736 72</pre></td></tr><tr><td data-num="4"></td><td><pre>## CP1041 335   335   335 2797.154 2775.245 2815.933  159058.8  149229.6  6295 13</pre></td></tr><tr><td data-num="5"></td><td><pre>## CP2002 335   335   335 2786.199 2764.290 2812.803  932645.2  915333.8 35856 66</pre></td></tr><tr><td data-num="6"></td><td><pre>## CP2391 335   335   335 2792.461 2768.987 2823.760  876585.5  848569.1 27200 36</pre></td></tr><tr><td data-num="7"></td><td><pre>##        sample row column</pre></td></tr><tr><td data-num="8"></td><td><pre>## CP0045      1   1      1</pre></td></tr><tr><td data-num="9"></td><td><pre>## CP0501      2   1      2</pre></td></tr><tr><td data-num="10"></td><td><pre>## CP1041      3   1      3</pre></td></tr><tr><td data-num="11"></td><td><pre>## CP2002      6   1      6</pre></td></tr><tr><td data-num="12"></td><td><pre>## CP2391      7   1      7</pre></td></tr></table></figure><p>我们还可以绘制提取的离子色谱图。已识别的色谱峰将在图中自动突出显示。下面我们用矩形突出显示色谱峰，从峰的最小到最大 rt，从 0 到峰的最大信号。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>sample_colors <span class="token operator">&lt;-</span> group_colors<span class="token punctuation">[</span>chr_ex<span class="token operator">$</span>sample_group<span class="token punctuation">]</span></pre></td></tr><tr><td data-num="2"></td><td><pre>png<span class="token punctuation">(</span>file<span class="token operator">=</span><span class="token string">"xcms_14.png"</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="3"></td><td><pre>plot<span class="token punctuation">(</span>chr_ex<span class="token punctuation">,</span> col <span class="token operator">=</span> sample_colors<span class="token punctuation">,</span> peakType <span class="token operator">=</span> <span class="token string">"rectangle"</span><span class="token punctuation">,</span> peakCol <span class="token operator">=</span> sample_colors<span class="token punctuation">[</span>chromPeaks<span class="token punctuation">(</span>chr_ex<span class="token punctuation">)</span><span class="token punctuation">[</span><span class="token punctuation">,</span> <span class="token string">"sample"</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">,</span> peakBg <span class="token operator">=</span> <span class="token keyword">NA</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="4"></td><td><pre>dev.off<span class="token punctuation">(</span><span class="token punctuation">)</span></pre></td></tr></table></figure><p><img data-src="https://fastly.jsdelivr.net/gh/liaochenlanruo/cdn@master/img/custom/metabolomics/xcms_14.png" alt="Signal for an example peak"></p><p><strong>图注</strong>：红色和蓝色分别代表 KO 和野生型样本。矩形表示每个样品的色谱峰。</p><p>作为上述矩形可视化的替代方案，可以用一个点表示每个峰的顶点位置（将参数 <code>type=&quot;point&quot;</code> 传递给函数），或通过指定 <code>type=&quot;polygon&quot;</code> 绘制实际识别的峰。为了完全省略突出显示已识别的峰（例如绘制基本峰色谱图或类似图），可以使用 <code>type = &quot;none&quot;</code> ”。下面我们使用 <code>type=&quot;polygon&quot;</code> 填充每个样品中每个已识别色谱峰的峰面积。然而，在这样的图中是否仍然可以识别单个峰取决于从中绘制峰的样本数量。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>png<span class="token punctuation">(</span>file<span class="token operator">=</span><span class="token string">"xcms_15.png"</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="2"></td><td><pre>plot<span class="token punctuation">(</span>chr_ex<span class="token punctuation">,</span> col <span class="token operator">=</span> group_colors<span class="token punctuation">[</span>chr_raw<span class="token operator">$</span>sample_group<span class="token punctuation">]</span><span class="token punctuation">,</span> lwd <span class="token operator">=</span> <span class="token number">2</span><span class="token punctuation">,</span></pre></td></tr><tr><td data-num="3"></td><td><pre>     peakBg <span class="token operator">=</span> sample_colors<span class="token punctuation">[</span>chromPeaks<span class="token punctuation">(</span>chr_ex<span class="token punctuation">)</span><span class="token punctuation">[</span><span class="token punctuation">,</span> <span class="token string">"sample"</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="4"></td><td><pre>dev.off<span class="token punctuation">(</span><span class="token punctuation">)</span></pre></td></tr></table></figure><p><img data-src="https://fastly.jsdelivr.net/gh/liaochenlanruo/cdn@master/img/custom/metabolomics/xcms_15.png" alt="Signal for an example peak"><br><strong>图注</strong>：红色和蓝色分别代表 KO 和野生型样本。已识别色谱峰的信号区域用颜色填充。</p><p>注意，我们还可以通过在 <code>chromPeaks</code> 方法中提供各自的 m/z 和保留时间范围以及 <code>mz</code> 和 <code>rt</code> 参数，提取选定区域的已鉴定色谱峰。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>pander<span class="token punctuation">(</span>chromPeaks<span class="token punctuation">(</span>xdata<span class="token punctuation">,</span> mz <span class="token operator">=</span> mzr<span class="token punctuation">,</span> rt <span class="token operator">=</span> rtr<span class="token punctuation">)</span><span class="token punctuation">,</span> caption <span class="token operator">=</span> paste<span class="token punctuation">(</span><span class="token string">"Identified chromatographic peaks in a selected "</span><span class="token punctuation">,</span> <span class="token string">"m/z and retention time range."</span><span class="token punctuation">)</span><span class="token punctuation">)</span></pre></td></tr></table></figure><figure class="highlight text"><figcaption data-lang="text"></figcaption><table><tr><td data-num="1"></td><td><pre>-----------------------------------------------------------------------------</pre></td></tr><tr><td data-num="2"></td><td><pre>   &amp;nbsp;     mz    mzmin   mzmax    rt    rtmin   rtmax    into      intb</pre></td></tr><tr><td data-num="3"></td><td><pre>------------ ----- ------- ------- ------ ------- ------- --------- ---------</pre></td></tr><tr><td data-num="4"></td><td><pre> **CP0045**   335    335     335    2782   2761    2810    412134    383167</pre></td></tr><tr><td data-num="5"></td><td><pre></pre></td></tr><tr><td data-num="6"></td><td><pre> **CP0501**   335    335     335    2786   2764    2813    1496244   1461187</pre></td></tr><tr><td data-num="7"></td><td><pre></pre></td></tr><tr><td data-num="8"></td><td><pre> **CP1041**   335    335     335    2797   2775    2816    159059    149230</pre></td></tr><tr><td data-num="9"></td><td><pre></pre></td></tr><tr><td data-num="10"></td><td><pre> **CP2002**   335    335     335    2786   2764    2813    932645    915334</pre></td></tr><tr><td data-num="11"></td><td><pre></pre></td></tr><tr><td data-num="12"></td><td><pre> **CP2391**   335    335     335    2792   2769    2824    876586    848569</pre></td></tr><tr><td data-num="13"></td><td><pre>-----------------------------------------------------------------------------</pre></td></tr><tr><td data-num="14"></td><td><pre></pre></td></tr><tr><td data-num="15"></td><td><pre>Table: Identified chromatographic peaks in a selected  m/z and retention time range. (continued below)</pre></td></tr><tr><td data-num="16"></td><td><pre></pre></td></tr><tr><td data-num="17"></td><td><pre></pre></td></tr><tr><td data-num="18"></td><td><pre>----------------------------------</pre></td></tr><tr><td data-num="19"></td><td><pre>   &amp;nbsp;     maxo    sn   sample</pre></td></tr><tr><td data-num="20"></td><td><pre>------------ ------- ---- --------</pre></td></tr><tr><td data-num="21"></td><td><pre> **CP0045**   16856   23     1</pre></td></tr><tr><td data-num="22"></td><td><pre></pre></td></tr><tr><td data-num="23"></td><td><pre> **CP0501**   58736   72     2</pre></td></tr><tr><td data-num="24"></td><td><pre></pre></td></tr><tr><td data-num="25"></td><td><pre> **CP1041**   6295    13     3</pre></td></tr><tr><td data-num="26"></td><td><pre></pre></td></tr><tr><td data-num="27"></td><td><pre> **CP2002**   35856   66     6</pre></td></tr><tr><td data-num="28"></td><td><pre></pre></td></tr><tr><td data-num="29"></td><td><pre> **CP2391**   27200   36     7</pre></td></tr><tr><td data-num="30"></td><td><pre>----------------------------------</pre></td></tr></table></figure><p>最后，我们还绘制了每个样本的峰强度分布。这允许调查样本之间的峰信号是否存在系统差异。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre><span class="token comment">## Extract a list of per-sample peak intensities (in log2 scale)</span></pre></td></tr><tr><td data-num="2"></td><td><pre>ints <span class="token operator">&lt;-</span> split<span class="token punctuation">(</span>log2<span class="token punctuation">(</span>chromPeaks<span class="token punctuation">(</span>xdata<span class="token punctuation">)</span><span class="token punctuation">[</span><span class="token punctuation">,</span> <span class="token string">"into"</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">,</span> f <span class="token operator">=</span> chromPeaks<span class="token punctuation">(</span>xdata<span class="token punctuation">)</span><span class="token punctuation">[</span><span class="token punctuation">,</span> <span class="token string">"sample"</span><span class="token punctuation">]</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="3"></td><td><pre>png<span class="token punctuation">(</span>file<span class="token operator">=</span><span class="token string">"xcms_16.png"</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="4"></td><td><pre>boxplot<span class="token punctuation">(</span>ints<span class="token punctuation">,</span> varwidth <span class="token operator">=</span> <span class="token boolean">TRUE</span><span class="token punctuation">,</span> col <span class="token operator">=</span> group_colors<span class="token punctuation">[</span>xdata<span class="token operator">$</span>sample_group<span class="token punctuation">]</span><span class="token punctuation">,</span> ylab <span class="token operator">=</span> expression<span class="token punctuation">(</span>log<span class="token punctuation">[</span><span class="token number">2</span><span class="token punctuation">]</span><span class="token operator">~</span>intensity<span class="token punctuation">)</span><span class="token punctuation">,</span> main <span class="token operator">=</span> <span class="token string">"Peak intensities"</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="5"></td><td><pre>grid<span class="token punctuation">(</span>nx <span class="token operator">=</span> <span class="token keyword">NA</span><span class="token punctuation">,</span> ny <span class="token operator">=</span> <span class="token keyword">NULL</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="6"></td><td><pre>dev.off<span class="token punctuation">(</span><span class="token punctuation">)</span></pre></td></tr></table></figure><p><img data-src="https://fastly.jsdelivr.net/gh/liaochenlanruo/cdn@master/img/custom/metabolomics/xcms_16.png" alt="Peak intensity distribution per sample"><br>注意，除了上述色谱峰的识别之外，还可以使用 <code>manualChromPeaks</code> 函数手动定义和添加色谱峰（更多信息请参见 <code>?manualChronPeaks</code> 帮助页面）。</p><h1 id="alignment"><a class="anchor" href="#alignment">#</a> Alignment</h1><p>分析物在色谱中洗脱的时间可能因样品（甚至化合物）而异。在上一节中作为示例所示的提取离子色谱图中已经可以观察到这种差异。对齐步骤，也称为保留时间校正，旨在通过沿保留时间轴移动信号来调整这一点，以在实验中对齐不同样本之间的信号。</p><p>存在很多的对齐算法（参见 [3]），其中一些算法也在 xcms 中实现。在 xcms 中执行对齐 / 保留时间校正的方法是 <code>adjustRtime</code> ，其根据所提供的参数类别使用不同的对齐算法。</p><p>在下面的示例中，我们使用<em> obiwarp</em> 方法 [4] 来对齐样本。我们使用 <code>binSize＝0.6</code> ，它在 mz 为 0.6 的 bins 中创建扭曲函数（warping functions）。此外，这里建议修改每个实验的设置，并评估保留时间校正是否对齐了内参或已知化合物。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>xdata <span class="token operator">&lt;-</span> adjustRtime<span class="token punctuation">(</span>xdata<span class="token punctuation">,</span> param <span class="token operator">=</span> ObiwarpParam<span class="token punctuation">(</span>binSize <span class="token operator">=</span> <span class="token number">0.6</span><span class="token punctuation">)</span><span class="token punctuation">)</span></pre></td></tr></table></figure><p><code>adjustRtime</code> ，除了计算每个光谱的校正保留时间外，还调整了已鉴定色谱峰的报告保留时间。</p><p>为了提取校正后的保留时间，我们可以使用 <code>adjustedRtime</code> 方法，或者简单地使用 <code>rtime</code> 方法，如果存在的话，默认情况下会从 <code>XCMSnExp</code> 对象返回校正后的保留时间。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre><span class="token comment">## Extract adjusted retention times</span></pre></td></tr><tr><td data-num="2"></td><td><pre>head<span class="token punctuation">(</span>adjustedRtime<span class="token punctuation">(</span>xdata<span class="token punctuation">)</span><span class="token punctuation">)</span></pre></td></tr></table></figure><figure class="highlight text"><figcaption data-lang="text"></figcaption><table><tr><td data-num="1"></td><td><pre>## F1.S0001 F1.S0002 F1.S0003 F1.S0004 F1.S0005 F1.S0006</pre></td></tr><tr><td data-num="2"></td><td><pre>## 2501.378 2502.958 2504.538 2506.118 2507.699 2509.280</pre></td></tr></table></figure><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre><span class="token comment">## Or simply use the rtime method</span></pre></td></tr><tr><td data-num="2"></td><td><pre>head<span class="token punctuation">(</span>rtime<span class="token punctuation">(</span>xdata<span class="token punctuation">)</span><span class="token punctuation">)</span></pre></td></tr></table></figure><figure class="highlight text"><figcaption data-lang="text"></figcaption><table><tr><td data-num="1"></td><td><pre>## F1.S0001 F1.S0002 F1.S0003 F1.S0004 F1.S0005 F1.S0006</pre></td></tr><tr><td data-num="2"></td><td><pre>## 2501.378 2502.958 2504.538 2506.118 2507.699 2509.280</pre></td></tr></table></figure><p>原始保留时间可以从包含与 <code>rtime(xdata，adjusted=FALSE)</code> 对齐的数据的 <code>XCMSnExp</code> 中提取。</p><p>为了评估对齐的影响，我们利用校正后的数据绘制 BPC。此外，我们使用 <code>plotAdjustedRtime</code> 函数绘制每个样本的校正后保留时间与原始保留时间的差异。对于基峰色谱图，从结果对象中提取已识别的色谱峰是没有意义的。因此，我们在 <code>chromatogram</code> 调用中使用参数 <code>include=&quot;none&quot;</code> ，以在返回的对象中不包含色谱峰。请注意，也可以通过在 <code>plot</code> 调用中设置 <code>peakType = &quot;none&quot;</code> 来避免绘制它们。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre><span class="token comment">## Get the base peak chromatograms.</span></pre></td></tr><tr><td data-num="2"></td><td><pre>bpis_adj <span class="token operator">&lt;-</span> chromatogram<span class="token punctuation">(</span>xdata<span class="token punctuation">,</span> aggregationFun <span class="token operator">=</span> <span class="token string">"max"</span><span class="token punctuation">,</span> include <span class="token operator">=</span> <span class="token string">"none"</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="3"></td><td><pre>par<span class="token punctuation">(</span>mfrow <span class="token operator">=</span> c<span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">,</span> mar <span class="token operator">=</span> c<span class="token punctuation">(</span><span class="token number">4.5</span><span class="token punctuation">,</span> <span class="token number">4.2</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">0.5</span><span class="token punctuation">)</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="4"></td><td><pre></pre></td></tr><tr><td data-num="5"></td><td><pre>png<span class="token punctuation">(</span>file<span class="token operator">=</span><span class="token string">"xcms_17.png"</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="6"></td><td><pre>plot<span class="token punctuation">(</span>bpis_adj<span class="token punctuation">,</span> col <span class="token operator">=</span> group_colors<span class="token punctuation">[</span>bpis_adj<span class="token operator">$</span>sample_group<span class="token punctuation">]</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="7"></td><td><pre>dev.off<span class="token punctuation">(</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="8"></td><td><pre></pre></td></tr><tr><td data-num="9"></td><td><pre><span class="token comment">## Plot also the difference of adjusted to raw retention time.</span></pre></td></tr><tr><td data-num="10"></td><td><pre>png<span class="token punctuation">(</span>file<span class="token operator">=</span><span class="token string">"xcms_18.png"</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="11"></td><td><pre>plotAdjustedRtime<span class="token punctuation">(</span>xdata<span class="token punctuation">,</span> col <span class="token operator">=</span> group_colors<span class="token punctuation">[</span>xdata<span class="token operator">$</span>sample_group<span class="token punctuation">]</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="12"></td><td><pre>dev.off<span class="token punctuation">(</span><span class="token punctuation">)</span></pre></td></tr></table></figure><p><img data-src="https://fastly.jsdelivr.net/gh/liaochenlanruo/cdn@master/img/custom/metabolomics/xcms_17.png" alt="Obiwarp aligned data"><br><img data-src="https://fastly.jsdelivr.net/gh/liaochenlanruo/cdn@master/img/custom/metabolomics/xcms_18.png" alt="Obiwarp aligned data"></p><p><strong>图注</strong>：对齐后的基峰色谱图（顶部）和沿保留时间轴的校正保留时间与原始保留时间之间的差异（底部）。</p><p>校正后的保留时间与原始保留时间之间的差异太大，可能表明样品或对齐效果不佳（poorly performing samples or alignment）。</p><p><strong>注意</strong>： <code>XCMSnExp</code> 对象保存原始数据以及校正后的保留时间，在大多数情况下，子设置（subsetting）将删除校正后的保持时间。因此，一些情况下用校正后的保留时间代替原始保留时间可能是有用的。这可以通过 <code>applyAdjustedRtime</code> 完成。</p><p>最后，我们评估了对齐对测试峰的影响。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>par<span class="token punctuation">(</span>mfrow <span class="token operator">=</span> c<span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="2"></td><td><pre><span class="token comment">## Plot the raw data</span></pre></td></tr><tr><td data-num="3"></td><td><pre>png<span class="token punctuation">(</span>file<span class="token operator">=</span><span class="token string">"xcms_19.png"</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="4"></td><td><pre>plot<span class="token punctuation">(</span>chr_raw<span class="token punctuation">,</span> col <span class="token operator">=</span> group_colors<span class="token punctuation">[</span>chr_raw<span class="token operator">$</span>sample_group<span class="token punctuation">]</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="5"></td><td><pre>dev.off<span class="token punctuation">(</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="6"></td><td><pre></pre></td></tr><tr><td data-num="7"></td><td><pre><span class="token comment">## Extract the chromatogram from the adjusted object</span></pre></td></tr><tr><td data-num="8"></td><td><pre>chr_adj <span class="token operator">&lt;-</span> chromatogram<span class="token punctuation">(</span>xdata<span class="token punctuation">,</span> rt <span class="token operator">=</span> rtr<span class="token punctuation">,</span> mz <span class="token operator">=</span> mzr<span class="token punctuation">)</span></pre></td></tr><tr><td data-num="9"></td><td><pre>png<span class="token punctuation">(</span>file<span class="token operator">=</span><span class="token string">"xcms_20.png"</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="10"></td><td><pre>plot<span class="token punctuation">(</span>chr_adj<span class="token punctuation">,</span> col <span class="token operator">=</span> group_colors<span class="token punctuation">[</span>chr_raw<span class="token operator">$</span>sample_group<span class="token punctuation">]</span><span class="token punctuation">,</span> peakType <span class="token operator">=</span> <span class="token string">"none"</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="11"></td><td><pre>dev.off<span class="token punctuation">(</span><span class="token punctuation">)</span></pre></td></tr></table></figure><p><img data-src="https://fastly.jsdelivr.net/gh/liaochenlanruo/cdn@master/img/custom/metabolomics/xcms_19.png" alt="Example extracted ion chromatogram before (top) and after alignment (bottom)"><br><img data-src="https://fastly.jsdelivr.net/gh/liaochenlanruo/cdn@master/img/custom/metabolomics/xcms_20.png" alt="Example extracted ion chromatogram before (top) and after alignment (bottom)"></p><h2 id="subset-based-alignment"><a class="anchor" href="#subset-based-alignment">#</a> Subset-based alignment</h2><p>在一些实验中，仅根据样本的子集进行比对可能会有所帮助，例如，如果 QC 样本定期注射（injected ），或者如果实验包含空白样本。xcms 中的对齐方法允许估计样本子集（不包括空白样本的所有样本或在测量运行期间定期注入的质控样本）的保留时间漂移，并使用这些来调整整个数据集。</p><p>参数 <code>subset</code> （ <code>PeakGroupsParam</code> 或 <code>ObiwarpParam</code> 对象）可用于定义样本子集，整个数据集的对齐将基于该样本子集（例如，子集是 QC 样本的索引），参数 <code>subsetAdjust</code> 允许指定调整遗漏样本（left-out samples）的方法。目前有两个选项可用：</p><ul><li><code>subsetAdjust = &quot;previous&quot;</code> ：根据先前子集样本（例如 QC 样本）的对齐结果调整非子集样本的保留时间。如果样本的顺序为 A1、B1、B2、A2、B3、B4，A 代表 QC 样本，B 代表研究样本，则使用 <code>subset = c(1, 4)</code> 和 <code>subsetAdjust = &quot;previous&quot;</code> 将导致所有 A 样本彼此对齐，而非子集样本 B1 和 B2 将根据子集样本 A1 和 B3 以及 B4 对 A2 样本的对齐结果进行调整。</li><li><code>subsetAdjust = &quot;average&quot;</code> ：基于先前和后续子集样本的对齐结果的内插（interpolation）来调整非子集样本的保留时间。在上述示例中，B1 将基于子集（QC）样本 A1 和 A2 之间的校正保留时间的平均值进行调整。由于在非子集样本 B3 和 B4 之后没有子集样本，因此将仅基于 A2 的对齐结果来校正这些样本。注意，加权平均值用于计算经校正的保留时间平均值，其使用非子集样本与子集样本的索引之差的倒数作为权重。因此，如果我们有类似 A1、B1、B2、A2 的设置，在校正非子集样本 B1 时，A1 的校正保留时间将比 A2 的更大，从而使其校正保留时间更接近 A1 的保留时间，而不是 A2 的保留时间。请参见下面的示例。</li></ul><p>这两种情况都需要对对象内的样本进行有意义的 / 正确的排序（例如按注入索引排序）。</p><p>以下示例旨在说明这些对齐选项的效果。我们假设 faahKO 数据集中的样本 1、4 和 7 是质控样本（样本池）。因此，我们希望基于这些样本执行对齐，随后基于来自相邻子集（QC）样本的结果的插值来校正剩余的样本（2、3、5、6 和 8）的保留时间。在初始峰分组后，我们使用峰组法（peak groups method）进行校准，通过子集参数传递我们希望校准所基于的样本的索引，并指定 <code>subsetAdjust = &quot;average&quot;</code> 以根据相邻子集 / QC 样本的校准结果的插值校正研究样本。</p><p>注意，对于任何子集对齐，所有参数（如 <code>minFraction</code> ）都是相对于子集的，而不是整个实验！</p><p>要重新执行对齐，我们可以首先使用 <code>dropAdjustedRtime</code> 函数删除以前的对齐结果。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>xdata <span class="token operator">&lt;-</span> dropAdjustedRtime<span class="token punctuation">(</span>xdata<span class="token punctuation">)</span></pre></td></tr><tr><td data-num="2"></td><td><pre></pre></td></tr><tr><td data-num="3"></td><td><pre><span class="token comment">## Define the experimental layout</span></pre></td></tr><tr><td data-num="4"></td><td><pre>xdata<span class="token operator">$</span>sample_type <span class="token operator">&lt;-</span> <span class="token string">"study"</span></pre></td></tr><tr><td data-num="5"></td><td><pre>xdata<span class="token operator">$</span>sample_type<span class="token punctuation">[</span>c<span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">,</span> <span class="token number">7</span><span class="token punctuation">)</span><span class="token punctuation">]</span> <span class="token operator">&lt;-</span> <span class="token string">"QC"</span></pre></td></tr></table></figure><p>接下来，我们必须进行初始对应分析，因为峰群对齐方法通过对齐之前识别的 hook 峰（存在于大多数 / 所有样品中的色谱峰；下一节将介绍所用算法的详细信息）来校正保留时间。我们在这里使用默认设置，但强烈建议为每个数据集调整参数。<br><code>PeakDensityParam</code> 必须定义样本组（即，将单个样本分配给实验中的样本组）。如果实验中没有样本组，则应将每个文件的样本组设置为单个值（例如 <code>rep(1, length(fileNames(xdata))</code> ）。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre><span class="token comment">## Initial peak grouping. Use sample_type as grouping variable</span></pre></td></tr><tr><td data-num="2"></td><td><pre>pdp_subs <span class="token operator">&lt;-</span> PeakDensityParam<span class="token punctuation">(</span>sampleGroups <span class="token operator">=</span> xdata<span class="token operator">$</span>sample_type<span class="token punctuation">,</span></pre></td></tr><tr><td data-num="3"></td><td><pre>                             minFraction <span class="token operator">=</span> <span class="token number">0.9</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="4"></td><td><pre>xdata <span class="token operator">&lt;-</span> groupChromPeaks<span class="token punctuation">(</span>xdata<span class="token punctuation">,</span> param <span class="token operator">=</span> pdp_subs<span class="token punctuation">)</span></pre></td></tr><tr><td data-num="5"></td><td><pre></pre></td></tr><tr><td data-num="6"></td><td><pre><span class="token comment">## Define subset-alignment options and perform the alignment</span></pre></td></tr><tr><td data-num="7"></td><td><pre>pgp_subs <span class="token operator">&lt;-</span> PeakGroupsParam<span class="token punctuation">(</span>minFraction <span class="token operator">=</span> <span class="token number">0.85</span><span class="token punctuation">,</span></pre></td></tr><tr><td data-num="8"></td><td><pre>                            subset <span class="token operator">=</span> which<span class="token punctuation">(</span>xdata<span class="token operator">$</span>sample_type <span class="token operator">==</span> <span class="token string">"QC"</span><span class="token punctuation">)</span><span class="token punctuation">,</span></pre></td></tr><tr><td data-num="9"></td><td><pre>                            subsetAdjust <span class="token operator">=</span> <span class="token string">"average"</span><span class="token punctuation">,</span> span <span class="token operator">=</span> <span class="token number">0.4</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="10"></td><td><pre>xdata <span class="token operator">&lt;-</span> adjustRtime<span class="token punctuation">(</span>xdata<span class="token punctuation">,</span> param <span class="token operator">=</span> pgp_subs<span class="token punctuation">)</span></pre></td></tr></table></figure><p>下面，我们绘制了对齐结果，用绿色标记了作为子集一部分的样本，其他样本用灰色标注。这很好地显示了 <code>subsetAdjust = &quot;average&quot;</code> 的插值是如何工作的：样本 2 的保留时间是根据子集样本 1 和 4 的保留时间进行校正的，但是，给更接近的子集样本 1 赋予了更大的权重，这导致校正后的样本 2 的保持时间与样本 1 的保持时间更相似。另一方面，样本 3 得到校正，给第二子集样本（4）赋予更多权重。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>clrs <span class="token operator">&lt;-</span> rep<span class="token punctuation">(</span><span class="token string">"#00000040"</span><span class="token punctuation">,</span> <span class="token number">8</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="2"></td><td><pre>clrs<span class="token punctuation">[</span>xdata<span class="token operator">$</span>sample_type <span class="token operator">==</span> <span class="token string">"QC"</span><span class="token punctuation">]</span> <span class="token operator">&lt;-</span> c<span class="token punctuation">(</span><span class="token string">"#00ce0080"</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="3"></td><td><pre>par<span class="token punctuation">(</span>mfrow <span class="token operator">=</span> c<span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">,</span> mar <span class="token operator">=</span> c<span class="token punctuation">(</span><span class="token number">4</span><span class="token punctuation">,</span> <span class="token number">4.5</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">0.5</span><span class="token punctuation">)</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="4"></td><td><pre>png<span class="token punctuation">(</span>file<span class="token operator">=</span><span class="token string">"xcms_21.png"</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="5"></td><td><pre>plot<span class="token punctuation">(</span>chromatogram<span class="token punctuation">(</span>xdata<span class="token punctuation">,</span> aggregationFun <span class="token operator">=</span> <span class="token string">"sum"</span><span class="token punctuation">)</span><span class="token punctuation">,</span> col <span class="token operator">=</span> clrs<span class="token punctuation">,</span> peakType <span class="token operator">=</span> <span class="token string">"none"</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="6"></td><td><pre>dev.off<span class="token punctuation">(</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="7"></td><td><pre>png<span class="token punctuation">(</span>file<span class="token operator">=</span><span class="token string">"xcms_22.png"</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="8"></td><td><pre>plotAdjustedRtime<span class="token punctuation">(</span>xdata<span class="token punctuation">,</span> col <span class="token operator">=</span> clrs<span class="token punctuation">,</span> peakGroupsPch <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">,</span> peakGroupsCol <span class="token operator">=</span> <span class="token string">"#00ce0040"</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="9"></td><td><pre>dev.off<span class="token punctuation">(</span><span class="token punctuation">)</span></pre></td></tr></table></figure><p><img data-src="https://fastly.jsdelivr.net/gh/liaochenlanruo/cdn@master/img/custom/metabolomics/xcms_21.png" alt="Subset-alignment results with option average"><br><img data-src="https://fastly.jsdelivr.net/gh/liaochenlanruo/cdn@master/img/custom/metabolomics/xcms_22.png" alt="Subset-alignment results with option average"></p><p><strong>图注</strong>：沿保留时间轴校正保留时间与原始保留时间之间的差异。对校准模型进行估算的样本显示为绿色，研究样本显示为灰色。</p><p>选项 <code>subsetAdjust = &quot;previous&quot;</code> 基于单个子集样本（先前的）校正非子集样本的保留时间，这在大多数情况下导致非子集样本校正后的保留时间与用于校正的子集样本高度相似。</p><h1 id="correspondence"><a class="anchor" href="#correspondence">#</a> Correspondence</h1><p>代谢组学预处理的最后一步是匹配样本之间（取决于设置，如果样本相邻，也在样本内）检测到的色谱峰的对应关系。在 xcms 中执行对应的方法是 <code>groupChromPeaks</code> 。我们将使用峰密度法 [5] 对色谱峰进行分组。该算法结合了色谱峰，这取决于沿着 mz 维度的小切片中沿着保留时间轴的峰密度。为了说明这一点，我们绘制了每个样品中具有多个色谱峰的 mz 切片的色谱图。我们使用 0.4 的 <code>minFraction</code> 参数值，因此每个样本组中至少有 40% 的样本中存在的色谱峰被分组为特征（feature）。样品组分配是使用 <code>sampleGroups</code> 参数指定的。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre><span class="token comment">## Define the mz slice.</span></pre></td></tr><tr><td data-num="2"></td><td><pre>mzr <span class="token operator">&lt;-</span> c<span class="token punctuation">(</span><span class="token number">305.05</span><span class="token punctuation">,</span> <span class="token number">305.15</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="3"></td><td><pre></pre></td></tr><tr><td data-num="4"></td><td><pre><span class="token comment">## Extract and plot the chromatograms</span></pre></td></tr><tr><td data-num="5"></td><td><pre>chr_mzr <span class="token operator">&lt;-</span> chromatogram<span class="token punctuation">(</span>xdata<span class="token punctuation">,</span> mz <span class="token operator">=</span> mzr<span class="token punctuation">)</span></pre></td></tr><tr><td data-num="6"></td><td><pre><span class="token comment">## Define the parameters for the peak density method</span></pre></td></tr><tr><td data-num="7"></td><td><pre>pdp <span class="token operator">&lt;-</span> PeakDensityParam<span class="token punctuation">(</span>sampleGroups <span class="token operator">=</span> xdata<span class="token operator">$</span>sample_group<span class="token punctuation">,</span> minFraction <span class="token operator">=</span> <span class="token number">0.4</span><span class="token punctuation">,</span> bw <span class="token operator">=</span> <span class="token number">30</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="8"></td><td><pre></pre></td></tr><tr><td data-num="9"></td><td><pre>png<span class="token punctuation">(</span>file<span class="token operator">=</span><span class="token string">"xcms_23.png"</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="10"></td><td><pre>plotChromPeakDensity<span class="token punctuation">(</span>chr_mzr<span class="token punctuation">,</span> col <span class="token operator">=</span> sample_colors<span class="token punctuation">,</span> param <span class="token operator">=</span> pdp<span class="token punctuation">,</span> peakBg <span class="token operator">=</span> sample_colors<span class="token punctuation">[</span>chromPeaks<span class="token punctuation">(</span>chr_mzr<span class="token punctuation">)</span><span class="token punctuation">[</span><span class="token punctuation">,</span> <span class="token string">"sample"</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">,</span> peakCol <span class="token operator">=</span> sample_colors<span class="token punctuation">[</span>chromPeaks<span class="token punctuation">(</span>chr_mzr<span class="token punctuation">)</span><span class="token punctuation">[</span><span class="token punctuation">,</span> <span class="token string">"sample"</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">,</span> peakPch <span class="token operator">=</span> <span class="token number">16</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="11"></td><td><pre>dev.off<span class="token punctuation">(</span><span class="token punctuation">)</span></pre></td></tr></table></figure><p><img data-src="https://fastly.jsdelivr.net/gh/liaochenlanruo/cdn@master/img/custom/metabolomics/xcms_23.png" alt="Example for peak density correspondence"></p><p><strong>图注</strong>：上图：具有多个色谱峰的 mz 切片的色谱图。下图：确定保留时间的色谱峰 (x 轴) 和不同 bw 参数值的实验样品内的指数 (y 轴)。黑线表示峰密度估计值。峰分组（基于提供的设置）由灰色矩形表示。</p><p>上图中的上部面板显示了每个样品的提取离子色谱图，突出显示了检测到的峰。中间和下部曲线显示了不同样品中每个检测到的峰的保留时间。黑色实线表示检测到的峰沿保留时间的密度分布。组合成特征（峰值组）的峰值用灰色矩形表示。这种类型的可视化非常适合在将示例 m/z 切片应用于完整数据集之前测试它们的对应设置。</p><p>下面，我们将基于定义设置（defined settings）对整个数据集进行对应分析。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre><span class="token comment">## Perform the correspondence</span></pre></td></tr><tr><td data-num="2"></td><td><pre>pdp <span class="token operator">&lt;-</span> PeakDensityParam<span class="token punctuation">(</span>sampleGroups <span class="token operator">=</span> xdata<span class="token operator">$</span>sample_group<span class="token punctuation">,</span> minFraction <span class="token operator">=</span> <span class="token number">0.4</span><span class="token punctuation">,</span> bw <span class="token operator">=</span> <span class="token number">30</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="3"></td><td><pre>xdata <span class="token operator">&lt;-</span> groupChromPeaks<span class="token punctuation">(</span>xdata<span class="token punctuation">,</span> param <span class="token operator">=</span> pdp<span class="token punctuation">)</span></pre></td></tr></table></figure><p>基于 xcms 的预处理结果可以通过 <code>quantify</code> 法从<em> SummarizedExperiment</em> 包中汇总为 <code>SummarizedExperiment</code> 对象。该对象将包含作为分析矩阵的特征丰度、作为 <code>rowData</code> （即行注释）的特征定义（其 m/z、保留时间和其他元数据）和作为 <code>colData</code> （即列注释）的样本 / 表型信息。所有处理历史记录都将放入对象的元数据中（metadata）。然后，该对象可以用于任何进一步的（与 xcms 无关的）处理和分析。</p><p>下面我们使用 <code>quantify</code> 来生成当前分析的结果对象。参数值和任何其他附加参数将传递给 <code>featureValues</code> 方法，该方法在内部用于创建特征丰度矩阵。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>res <span class="token operator">&lt;-</span> quantify<span class="token punctuation">(</span>xdata<span class="token punctuation">,</span> value <span class="token operator">=</span> <span class="token string">"into"</span><span class="token punctuation">)</span></pre></td></tr></table></figure><p>样品注释可以通过 <code>colData</code> 方法访问。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>colData<span class="token punctuation">(</span>res<span class="token punctuation">)</span></pre></td></tr></table></figure><figure class="highlight text"><figcaption data-lang="text"></figcaption><table><tr><td data-num="1"></td><td><pre>## DataFrame with 8 rows and 3 columns</pre></td></tr><tr><td data-num="2"></td><td><pre>##          sample_name sample_group sample_type</pre></td></tr><tr><td data-num="3"></td><td><pre>##          &lt;character>  &lt;character> &lt;character></pre></td></tr><tr><td data-num="4"></td><td><pre>## ko15.CDF        ko15           KO          QC</pre></td></tr><tr><td data-num="5"></td><td><pre>## ko16.CDF        ko16           KO       study</pre></td></tr><tr><td data-num="6"></td><td><pre>## ko21.CDF        ko21           KO       study</pre></td></tr><tr><td data-num="7"></td><td><pre>## ko22.CDF        ko22           KO          QC</pre></td></tr><tr><td data-num="8"></td><td><pre>## wt15.CDF        wt15           WT       study</pre></td></tr><tr><td data-num="9"></td><td><pre>## wt16.CDF        wt16           WT       study</pre></td></tr><tr><td data-num="10"></td><td><pre>## wt21.CDF        wt21           WT          QC</pre></td></tr><tr><td data-num="11"></td><td><pre>## wt22.CDF        wt22           WT       study</pre></td></tr></table></figure><p>通过 <code>rowData</code> 注释特征：</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>rowData<span class="token punctuation">(</span>res<span class="token punctuation">)</span></pre></td></tr></table></figure><figure class="highlight text"><figcaption data-lang="text"></figcaption><table><tr><td data-num="1"></td><td><pre>DataFrame with 357 rows and 11 columns</pre></td></tr><tr><td data-num="2"></td><td><pre>          mzmed     mzmin     mzmax     rtmed     rtmin     rtmax    npeaks</pre></td></tr><tr><td data-num="3"></td><td><pre>      &lt;numeric> &lt;numeric> &lt;numeric> &lt;numeric> &lt;numeric> &lt;numeric> &lt;numeric></pre></td></tr><tr><td data-num="4"></td><td><pre>FT001     200.1     200.1     200.1   2902.25   2882.24   2922.27         2</pre></td></tr><tr><td data-num="5"></td><td><pre>FT002     205.0     205.0     205.0   2789.40   2782.36   2795.94         8</pre></td></tr><tr><td data-num="6"></td><td><pre>FT003     206.0     206.0     206.0   2788.64   2780.79   2793.78         7</pre></td></tr><tr><td data-num="7"></td><td><pre>FT004     207.1     207.1     207.1   2718.25   2713.28   2726.63         7</pre></td></tr><tr><td data-num="8"></td><td><pre>FT005     219.1     219.1     219.1   2518.60   2517.35   2521.09         3</pre></td></tr><tr><td data-num="9"></td><td><pre>...         ...       ...       ...       ...       ...       ...       ...</pre></td></tr><tr><td data-num="10"></td><td><pre>FT353    595.25     595.2     595.3   3010.39   2992.58   3014.38         6</pre></td></tr><tr><td data-num="11"></td><td><pre>FT354    596.20     596.2     596.2   2997.60   2992.58   3002.61         2</pre></td></tr><tr><td data-num="12"></td><td><pre>FT355    596.30     596.3     596.3   3818.98   3811.68   3835.78         4</pre></td></tr><tr><td data-num="13"></td><td><pre>FT356    597.40     597.4     597.4   3821.10   3817.96   3825.14         3</pre></td></tr><tr><td data-num="14"></td><td><pre>FT357    599.30     599.3     599.3   4070.45   4042.10   4123.52         3</pre></td></tr><tr><td data-num="15"></td><td><pre>             KO        WT            peakidx  ms_level</pre></td></tr><tr><td data-num="16"></td><td><pre>      &lt;numeric> &lt;numeric>             &lt;list> &lt;integer></pre></td></tr><tr><td data-num="17"></td><td><pre>FT001         2         0           463,1180         1</pre></td></tr><tr><td data-num="18"></td><td><pre>FT002         4         4     47,448,960,...         1</pre></td></tr><tr><td data-num="19"></td><td><pre>FT003         3         4   32, 435,1164,...         1</pre></td></tr><tr><td data-num="20"></td><td><pre>FT004         4         3     19,425,943,...         1</pre></td></tr><tr><td data-num="21"></td><td><pre>FT005         1         2     1140,1379,2382         1</pre></td></tr><tr><td data-num="22"></td><td><pre>...         ...       ...                ...       ...</pre></td></tr><tr><td data-num="23"></td><td><pre>FT353         2         3   67, 529,1466,...         1</pre></td></tr><tr><td data-num="24"></td><td><pre>FT354         0         2          1457,2452         1</pre></td></tr><tr><td data-num="25"></td><td><pre>FT355         2         2  332,1110,2071,...         1</pre></td></tr><tr><td data-num="26"></td><td><pre>FT356         1         2      838,2355,2680         1</pre></td></tr><tr><td data-num="27"></td><td><pre>FT357         1         2      375,1757,2137         1</pre></td></tr></table></figure><p>特征丰度可以通过 <code>assay</code> 方法获得。还要注意， <code>SummarizedExperiment</code> 支持多个这样的分析矩阵。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>head<span class="token punctuation">(</span>assay<span class="token punctuation">(</span>res<span class="token punctuation">)</span><span class="token punctuation">)</span></pre></td></tr></table></figure><figure class="highlight text"><figcaption data-lang="text"></figcaption><table><tr><td data-num="1"></td><td><pre>ko15.CDF  ko16.CDF  ko21.CDF  ko22.CDF  wt15.CDF  wt16.CDF  wt21.CDF</pre></td></tr><tr><td data-num="2"></td><td><pre>FT001        NA  506848.9        NA  169955.6        NA        NA        NA</pre></td></tr><tr><td data-num="3"></td><td><pre>FT002 1924712.0 1757151.0 1383416.7 1180288.2 2129885.1 1634342.0 1623589.2</pre></td></tr><tr><td data-num="4"></td><td><pre>FT003  213659.3  289500.7        NA  178285.7  253825.6  241844.4  240606.0</pre></td></tr><tr><td data-num="5"></td><td><pre>FT004  349011.5  451863.7  343897.8  208002.8  364609.8  360908.9        NA</pre></td></tr><tr><td data-num="6"></td><td><pre>FT005        NA        NA        NA  107348.5  223951.8        NA        NA</pre></td></tr><tr><td data-num="7"></td><td><pre>FT006  286221.4        NA  164009.0  149097.6  255697.7  311296.8  366441.5</pre></td></tr><tr><td data-num="8"></td><td><pre>        wt22.CDF</pre></td></tr><tr><td data-num="9"></td><td><pre>FT001         NA</pre></td></tr><tr><td data-num="10"></td><td><pre>FT002 1354004.93</pre></td></tr><tr><td data-num="11"></td><td><pre>FT003  185399.47</pre></td></tr><tr><td data-num="12"></td><td><pre>FT004  221937.53</pre></td></tr><tr><td data-num="13"></td><td><pre>FT005   84772.92</pre></td></tr><tr><td data-num="14"></td><td><pre>FT006  271128.02</pre></td></tr></table></figure><p>此外，还可以使用 <code>featureDefinitions</code> 和 <code>featureValues</code> 方法分别从对应分析中提取结果，前者返回带有特征定义的数据框 (即 mz 和 rt 范围，在列 peakidx 中为每个特征的 <code>chromPeaks</code> 矩阵中的色谱峰指数)，后者为特征丰度。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre><span class="token comment">## Extract the feature definitions</span></pre></td></tr><tr><td data-num="2"></td><td><pre>featureDefinitions<span class="token punctuation">(</span>xdata<span class="token punctuation">)</span></pre></td></tr></table></figure><figure class="highlight text"><figcaption data-lang="text"></figcaption><table><tr><td data-num="1"></td><td><pre>DataFrame with 357 rows and 11 columns</pre></td></tr><tr><td data-num="2"></td><td><pre>          mzmed     mzmin     mzmax     rtmed     rtmin     rtmax    npeaks</pre></td></tr><tr><td data-num="3"></td><td><pre>      &lt;numeric> &lt;numeric> &lt;numeric> &lt;numeric> &lt;numeric> &lt;numeric> &lt;numeric></pre></td></tr><tr><td data-num="4"></td><td><pre>FT001     200.1     200.1     200.1   2902.25   2882.24   2922.27         2</pre></td></tr><tr><td data-num="5"></td><td><pre>FT002     205.0     205.0     205.0   2789.40   2782.36   2795.94         8</pre></td></tr><tr><td data-num="6"></td><td><pre>FT003     206.0     206.0     206.0   2788.64   2780.79   2793.78         7</pre></td></tr><tr><td data-num="7"></td><td><pre>FT004     207.1     207.1     207.1   2718.25   2713.28   2726.63         7</pre></td></tr><tr><td data-num="8"></td><td><pre>FT005     219.1     219.1     219.1   2518.60   2517.35   2521.09         3</pre></td></tr><tr><td data-num="9"></td><td><pre>...         ...       ...       ...       ...       ...       ...       ...</pre></td></tr><tr><td data-num="10"></td><td><pre>FT353    595.25     595.2     595.3   3010.39   2992.58   3014.38         6</pre></td></tr><tr><td data-num="11"></td><td><pre>FT354    596.20     596.2     596.2   2997.60   2992.58   3002.61         2</pre></td></tr><tr><td data-num="12"></td><td><pre>FT355    596.30     596.3     596.3   3818.98   3811.68   3835.78         4</pre></td></tr><tr><td data-num="13"></td><td><pre>FT356    597.40     597.4     597.4   3821.10   3817.96   3825.14         3</pre></td></tr><tr><td data-num="14"></td><td><pre>FT357    599.30     599.3     599.3   4070.45   4042.10   4123.52         3</pre></td></tr><tr><td data-num="15"></td><td><pre>             KO        WT            peakidx  ms_level</pre></td></tr><tr><td data-num="16"></td><td><pre>      &lt;numeric> &lt;numeric>             &lt;list> &lt;integer></pre></td></tr><tr><td data-num="17"></td><td><pre>FT001         2         0           463,1180         1</pre></td></tr><tr><td data-num="18"></td><td><pre>FT002         4         4     47,448,960,...         1</pre></td></tr><tr><td data-num="19"></td><td><pre>FT003         3         4   32, 435,1164,...         1</pre></td></tr><tr><td data-num="20"></td><td><pre>FT004         4         3     19,425,943,...         1</pre></td></tr><tr><td data-num="21"></td><td><pre>FT005         1         2     1140,1379,2382         1</pre></td></tr><tr><td data-num="22"></td><td><pre>...         ...       ...                ...       ...</pre></td></tr><tr><td data-num="23"></td><td><pre>FT353         2         3   67, 529,1466,...         1</pre></td></tr><tr><td data-num="24"></td><td><pre>FT354         0         2          1457,2452         1</pre></td></tr><tr><td data-num="25"></td><td><pre>FT355         2         2  332,1110,2071,...         1</pre></td></tr><tr><td data-num="26"></td><td><pre>FT356         1         2      838,2355,2680         1</pre></td></tr><tr><td data-num="27"></td><td><pre>FT357         1         2      375,1757,2137         1</pre></td></tr></table></figure><p><code>featureValues</code> 方法返回一个矩阵，其中行是特征，列是样本。这个矩阵的内容可以使用 <code>value</code> 参数定义。默认值 <code>value = &quot;into&quot;</code> 返回一个矩阵，其中包含样本中某个特征对应的峰的整合信号。 <code>chromPeaks</code> 矩阵的任何列名都可以传递给参数 <code>value</code> 。下面我们提取每个特征 / 样本的整合峰值强度。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre><span class="token comment">## Extract the into column for each feature.</span></pre></td></tr><tr><td data-num="2"></td><td><pre>head<span class="token punctuation">(</span>featureValues<span class="token punctuation">(</span>xdata<span class="token punctuation">,</span> value <span class="token operator">=</span> <span class="token string">"into"</span><span class="token punctuation">)</span><span class="token punctuation">)</span></pre></td></tr></table></figure><figure class="highlight text"><figcaption data-lang="text"></figcaption><table><tr><td data-num="1"></td><td><pre>ko15.CDF  ko16.CDF  ko21.CDF  ko22.CDF  wt15.CDF  wt16.CDF  wt21.CDF</pre></td></tr><tr><td data-num="2"></td><td><pre>FT001        NA  506848.9        NA  169955.6        NA        NA        NA</pre></td></tr><tr><td data-num="3"></td><td><pre>FT002 1924712.0 1757151.0 1383416.7 1180288.2 2129885.1 1634342.0 1623589.2</pre></td></tr><tr><td data-num="4"></td><td><pre>FT003  213659.3  289500.7        NA  178285.7  253825.6  241844.4  240606.0</pre></td></tr><tr><td data-num="5"></td><td><pre>FT004  349011.5  451863.7  343897.8  208002.8  364609.8  360908.9        NA</pre></td></tr><tr><td data-num="6"></td><td><pre>FT005        NA        NA        NA  107348.5  223951.8        NA        NA</pre></td></tr><tr><td data-num="7"></td><td><pre>FT006  286221.4        NA  164009.0  149097.6  255697.7  311296.8  366441.5</pre></td></tr><tr><td data-num="8"></td><td><pre>        wt22.CDF</pre></td></tr><tr><td data-num="9"></td><td><pre>FT001         NA</pre></td></tr><tr><td data-num="10"></td><td><pre>FT002 1354004.93</pre></td></tr><tr><td data-num="11"></td><td><pre>FT003  185399.47</pre></td></tr><tr><td data-num="12"></td><td><pre>FT004  221937.53</pre></td></tr><tr><td data-num="13"></td><td><pre>FT005   84772.92</pre></td></tr><tr><td data-num="14"></td><td><pre>FT006  271128.02</pre></td></tr></table></figure><p>该特征矩阵包含某些样品在特征 m/z-rt 区域未检测到色谱峰（NA 值）。虽然在许多情况下，在相应的区域可能确实没有峰信号，但也可能有信号，但峰检测算法未能检测到色谱峰 (例如，因为信号太低或噪声太大)。xcms 提供 <code>fillChromPeaks</code> 方法来填充原始文件中这些缺失值的强度数据。填充的峰被添加到 chromPeaks 矩阵中，并在 <code>chromPeakData</code> 数据框的 <code>“is_filled”</code> 列中用 <code>TRUE</code> 表示。下面我们执行这样的填充。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>xdata <span class="token operator">&lt;-</span> fillChromPeaks<span class="token punctuation">(</span>xdata<span class="token punctuation">,</span> param <span class="token operator">=</span> ChromPeakAreaParam<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="2"></td><td><pre></pre></td></tr><tr><td data-num="3"></td><td><pre>head<span class="token punctuation">(</span>featureValues<span class="token punctuation">(</span>xdata<span class="token punctuation">)</span><span class="token punctuation">)</span></pre></td></tr></table></figure><figure class="highlight text"><figcaption data-lang="text"></figcaption><table><tr><td data-num="1"></td><td><pre>ko15.CDF   ko16.CDF   ko21.CDF  ko22.CDF  wt15.CDF  wt16.CDF  wt21.CDF</pre></td></tr><tr><td data-num="2"></td><td><pre>FT001  135315.2  506848.88  111783.48  169955.6  210166.7  141768.0  233086.7</pre></td></tr><tr><td data-num="3"></td><td><pre>FT002 1924712.0 1757150.96 1383416.72 1180288.2 2129885.1 1634342.0 1623589.2</pre></td></tr><tr><td data-num="4"></td><td><pre>FT003  213659.3  289500.67  164404.50  178285.7  253825.6  241844.4  240606.0</pre></td></tr><tr><td data-num="5"></td><td><pre>FT004  349011.5  451863.66  343897.76  208002.8  364609.8  360908.9  225332.1</pre></td></tr><tr><td data-num="6"></td><td><pre>FT005  161425.0   37819.63   82574.72  107348.5  223951.8  135617.6  191928.5</pre></td></tr><tr><td data-num="7"></td><td><pre>FT006  286221.4  286834.04  164008.97  149097.6  255697.7  311296.8  366441.5</pre></td></tr><tr><td data-num="8"></td><td><pre>        wt22.CDF</pre></td></tr><tr><td data-num="9"></td><td><pre>FT001  142142.23</pre></td></tr><tr><td data-num="10"></td><td><pre>FT002 1354004.93</pre></td></tr><tr><td data-num="11"></td><td><pre>FT003  185399.47</pre></td></tr><tr><td data-num="12"></td><td><pre>FT004  221937.53</pre></td></tr><tr><td data-num="13"></td><td><pre>FT005   84772.92</pre></td></tr><tr><td data-num="14"></td><td><pre>FT006  271128.02</pre></td></tr></table></figure><p>对于样本中没有检测到峰的特征，该方法提取特征的 mz-rt 区域中的所有强度，对信号进行整合（integrates），并将填充的峰添加到 <code>chromPeaks</code> 矩阵中。如果特征的 mz-rt 区域没有测量 / 可用信号，则不添加峰。对于这些，即使在填写了缺失的峰数据后，也会在 <code>featureValues</code> 矩阵中报告 NA。</p><p>可以使用不同的选项来定义特征的 mz-rt 区域。使用上面使用的 <code>ChromPeakAreaParam()</code> 参数对象，使用其所有（检测到的）色谱峰的 m/z 和 rt 范围定义特征区域：区域中低的 m/z 值定义为特征所有峰的 “mzmin” 值的下四分位（25% 分位数），高 m/z 值为 “mzmax” 值的上四分位数（75% 分位数），低 rt 值作为 “rtmin” 值的下四分位（25% 分位数），高 rt 值为 “rtmax” 值的上四分位数（75% 分位数）。这确保了信号是从特定特征区域集成的。</p><p>或者，可以在 <code>fillChromPeaks</code> 调用中使用 <code>FillChromPpeaksParam</code> 参数对象，这类似于初始（old）xcms 实现的方法。</p><p>下面我们比较填写缺失值前后缺失值的数量。我们可以使用 <code>featureValues</code> 方法的 <code>filled</code> 参数来定义是否也应该返回填充的峰值（filled-in peak values）。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre><span class="token comment">## Missing values before filling in peaks</span></pre></td></tr><tr><td data-num="2"></td><td><pre>apply<span class="token punctuation">(</span>featureValues<span class="token punctuation">(</span>xdata<span class="token punctuation">,</span> filled <span class="token operator">=</span> <span class="token boolean">FALSE</span><span class="token punctuation">)</span><span class="token punctuation">,</span> MARGIN <span class="token operator">=</span> <span class="token number">2</span><span class="token punctuation">,</span> FUN <span class="token operator">=</span> <span class="token keyword">function</span><span class="token punctuation">(</span>z<span class="token punctuation">)</span> sum<span class="token punctuation">(</span>is.na<span class="token punctuation">(</span>z<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span></pre></td></tr></table></figure><figure class="highlight text"><figcaption data-lang="text"></figcaption><table><tr><td data-num="1"></td><td><pre>## ko15.CDF ko16.CDF ko21.CDF ko22.CDF wt15.CDF wt16.CDF wt21.CDF wt22.CDF</pre></td></tr><tr><td data-num="2"></td><td><pre>##       91       93      168      154       95      119      167      123</pre></td></tr></table></figure><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre><span class="token comment">## Missing values after filling in peaks</span></pre></td></tr><tr><td data-num="2"></td><td><pre>apply<span class="token punctuation">(</span>featureValues<span class="token punctuation">(</span>xdata<span class="token punctuation">)</span><span class="token punctuation">,</span> MARGIN <span class="token operator">=</span> <span class="token number">2</span><span class="token punctuation">,</span> FUN <span class="token operator">=</span> <span class="token keyword">function</span><span class="token punctuation">(</span>z<span class="token punctuation">)</span> sum<span class="token punctuation">(</span>is.na<span class="token punctuation">(</span>z<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span></pre></td></tr></table></figure><figure class="highlight text"><figcaption data-lang="text"></figcaption><table><tr><td data-num="1"></td><td><pre>## ko15.CDF ko16.CDF ko21.CDF ko22.CDF wt15.CDF wt16.CDF wt21.CDF wt22.CDF</pre></td></tr><tr><td data-num="2"></td><td><pre>##        5        4        5        5        4        7        6        2</pre></td></tr></table></figure><p>接下来，我们使用 <code>featureSummary</code> 函数获取每个特征的一般摘要，其中包括找到峰的样本数量或为特征分配了多个峰的样本数。同时指定样本组可以分解每个样本组的汇总统计信息。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>head<span class="token punctuation">(</span>featureSummary<span class="token punctuation">(</span>xdata<span class="token punctuation">,</span> group <span class="token operator">=</span> xdata<span class="token operator">$</span>sample_group<span class="token punctuation">)</span><span class="token punctuation">)</span></pre></td></tr></table></figure><figure class="highlight text"><figcaption data-lang="text"></figcaption><table><tr><td data-num="1"></td><td><pre>count  perc multi_count multi_perc       rsd KO_count KO_perc</pre></td></tr><tr><td data-num="2"></td><td><pre>FT001     2  25.0           0          0 0.7039537        2      50</pre></td></tr><tr><td data-num="3"></td><td><pre>FT002     8 100.0           0          0 0.1936518        4     100</pre></td></tr><tr><td data-num="4"></td><td><pre>FT003     7  87.5           0          0 0.1717662        3      75</pre></td></tr><tr><td data-num="5"></td><td><pre>FT004     7  87.5           0          0 0.2609145        4     100</pre></td></tr><tr><td data-num="6"></td><td><pre>FT005     3  37.5           0          0 0.5385767        1      25</pre></td></tr><tr><td data-num="7"></td><td><pre>FT006     7  87.5           0          0 0.3016973        3      75</pre></td></tr><tr><td data-num="8"></td><td><pre>      KO_multi_count KO_multi_perc    KO_rsd WT_count WT_perc WT_multi_count</pre></td></tr><tr><td data-num="9"></td><td><pre>FT001              0             0 0.7039537        0       0              0</pre></td></tr><tr><td data-num="10"></td><td><pre>FT002              0             0 0.2178920        4     100              0</pre></td></tr><tr><td data-num="11"></td><td><pre>FT003              0             0 0.2501505        4     100              0</pre></td></tr><tr><td data-num="12"></td><td><pre>FT004              0             0 0.2957873        3      75              0</pre></td></tr><tr><td data-num="13"></td><td><pre>FT005              0             0        NA        2      50              0</pre></td></tr><tr><td data-num="14"></td><td><pre>FT006              0             0 0.3765933        4     100              0</pre></td></tr><tr><td data-num="15"></td><td><pre>      WT_multi_perc    WT_rsd</pre></td></tr><tr><td data-num="16"></td><td><pre>FT001             0        NA</pre></td></tr><tr><td data-num="17"></td><td><pre>FT002             0 0.1918936</pre></td></tr><tr><td data-num="18"></td><td><pre>FT003             0 0.1327983</pre></td></tr><tr><td data-num="19"></td><td><pre>FT004             0 0.2575039</pre></td></tr><tr><td data-num="20"></td><td><pre>FT005             0 0.6375539</pre></td></tr><tr><td data-num="21"></td><td><pre>FT006             0 0.1641781</pre></td></tr></table></figure><p>我们可以将特征值矩阵与缺失峰值的填充数据一起添加到我们的 <code>SummarizedExperiment</code> 对象 res 中，作为附加矩阵（assay）：</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>assays<span class="token punctuation">(</span>res<span class="token punctuation">)</span><span class="token operator">$</span>raw_filled <span class="token operator">&lt;-</span> featureValues<span class="token punctuation">(</span>xdata<span class="token punctuation">,</span> filled <span class="token operator">=</span> <span class="token boolean">TRUE</span><span class="token punctuation">)</span></pre></td></tr></table></figure><p>我们现在有两个可用的矩阵（assays），一个具有检测值的矩阵，一个包含检测值和填充值的矩阵，每个都可以通过其名称访问。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>assayNames<span class="token punctuation">(</span>res<span class="token punctuation">)</span></pre></td></tr></table></figure><figure class="highlight text"><figcaption data-lang="text"></figcaption><table><tr><td data-num="1"></td><td><pre>## [1] "raw"        "raw_filled"</pre></td></tr></table></figure><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>head<span class="token punctuation">(</span>assay<span class="token punctuation">(</span>res<span class="token punctuation">,</span> <span class="token string">"raw"</span><span class="token punctuation">)</span><span class="token punctuation">)</span></pre></td></tr></table></figure><figure class="highlight text"><figcaption data-lang="text"></figcaption><table><tr><td data-num="1"></td><td><pre>ko15.CDF  ko16.CDF  ko21.CDF  ko22.CDF  wt15.CDF  wt16.CDF  wt21.CDF</pre></td></tr><tr><td data-num="2"></td><td><pre>FT001        NA  506848.9        NA  169955.6        NA        NA        NA</pre></td></tr><tr><td data-num="3"></td><td><pre>FT002 1924712.0 1757151.0 1383416.7 1180288.2 2129885.1 1634342.0 1623589.2</pre></td></tr><tr><td data-num="4"></td><td><pre>FT003  213659.3  289500.7        NA  178285.7  253825.6  241844.4  240606.0</pre></td></tr><tr><td data-num="5"></td><td><pre>FT004  349011.5  451863.7  343897.8  208002.8  364609.8  360908.9        NA</pre></td></tr><tr><td data-num="6"></td><td><pre>FT005        NA        NA        NA  107348.5  223951.8        NA        NA</pre></td></tr><tr><td data-num="7"></td><td><pre>FT006  286221.4        NA  164009.0  149097.6  255697.7  311296.8  366441.5</pre></td></tr><tr><td data-num="8"></td><td><pre>        wt22.CDF</pre></td></tr><tr><td data-num="9"></td><td><pre>FT001         NA</pre></td></tr><tr><td data-num="10"></td><td><pre>FT002 1354004.93</pre></td></tr><tr><td data-num="11"></td><td><pre>FT003  185399.47</pre></td></tr><tr><td data-num="12"></td><td><pre>FT004  221937.53</pre></td></tr><tr><td data-num="13"></td><td><pre>FT005   84772.92</pre></td></tr><tr><td data-num="14"></td><td><pre>FT006  271128.02</pre></td></tr></table></figure><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>head<span class="token punctuation">(</span>assay<span class="token punctuation">(</span>res<span class="token punctuation">,</span> <span class="token string">"raw_filled"</span><span class="token punctuation">)</span><span class="token punctuation">)</span></pre></td></tr></table></figure><figure class="highlight text"><figcaption data-lang="text"></figcaption><table><tr><td data-num="1"></td><td><pre>ko15.CDF   ko16.CDF   ko21.CDF  ko22.CDF  wt15.CDF  wt16.CDF  wt21.CDF</pre></td></tr><tr><td data-num="2"></td><td><pre>FT001  135315.2  506848.88  111783.48  169955.6  210166.7  141768.0  233086.7</pre></td></tr><tr><td data-num="3"></td><td><pre>FT002 1924712.0 1757150.96 1383416.72 1180288.2 2129885.1 1634342.0 1623589.2</pre></td></tr><tr><td data-num="4"></td><td><pre>FT003  213659.3  289500.67  164404.50  178285.7  253825.6  241844.4  240606.0</pre></td></tr><tr><td data-num="5"></td><td><pre>FT004  349011.5  451863.66  343897.76  208002.8  364609.8  360908.9  225332.1</pre></td></tr><tr><td data-num="6"></td><td><pre>FT005  161425.0   37819.63   82574.72  107348.5  223951.8  135617.6  191928.5</pre></td></tr><tr><td data-num="7"></td><td><pre>FT006  286221.4  286834.04  164008.97  149097.6  255697.7  311296.8  366441.5</pre></td></tr><tr><td data-num="8"></td><td><pre>        wt22.CDF</pre></td></tr><tr><td data-num="9"></td><td><pre>FT001  142142.23</pre></td></tr><tr><td data-num="10"></td><td><pre>FT002 1354004.93</pre></td></tr><tr><td data-num="11"></td><td><pre>FT003  185399.47</pre></td></tr><tr><td data-num="12"></td><td><pre>FT004  221937.53</pre></td></tr><tr><td data-num="13"></td><td><pre>FT005   84772.92</pre></td></tr><tr><td data-num="14"></td><td><pre>FT006  271128.02</pre></td></tr></table></figure><p>应始终通过检查提取的离子色谱图（例如已知化合物、内标或一般识别特征）来评估峰检测、比对（alignment）和对应（correspondence）的性能。 <code>featureChromatogram</code> 函数允许提取 <code>featureDefinitions</code> 中每个特征的色谱图。返回的 <code>MCchromatograms</code> 对象包含每个特征（每行包含一个特征的数据）和样本（每列代表一个样本的数据）的离子色谱图。下面我们提取前 4 个特征的色谱图。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>feature_chroms <span class="token operator">&lt;-</span> featureChromatograms<span class="token punctuation">(</span>xdata<span class="token punctuation">,</span> features <span class="token operator">=</span> <span class="token number">1</span><span class="token operator">:</span><span class="token number">4</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="2"></td><td><pre></pre></td></tr><tr><td data-num="3"></td><td><pre>feature_chroms</pre></td></tr></table></figure><figure class="highlight text"><figcaption data-lang="text"></figcaption><table><tr><td data-num="1"></td><td><pre>## XChromatograms with 4 rows and 8 columns</pre></td></tr><tr><td data-num="2"></td><td><pre>##                    1               2               3               4</pre></td></tr><tr><td data-num="3"></td><td><pre>##      &lt;XChromatogram> &lt;XChromatogram> &lt;XChromatogram> &lt;XChromatogram></pre></td></tr><tr><td data-num="4"></td><td><pre>## [1,]        peaks: 0        peaks: 1        peaks: 0        peaks: 1</pre></td></tr><tr><td data-num="5"></td><td><pre>## [2,]        peaks: 1        peaks: 1        peaks: 1        peaks: 1</pre></td></tr><tr><td data-num="6"></td><td><pre>## [3,]        peaks: 1        peaks: 1        peaks: 0        peaks: 1</pre></td></tr><tr><td data-num="7"></td><td><pre>## [4,]        peaks: 1        peaks: 1        peaks: 1        peaks: 1</pre></td></tr><tr><td data-num="8"></td><td><pre>##                    5               6               7               8</pre></td></tr><tr><td data-num="9"></td><td><pre>##      &lt;XChromatogram> &lt;XChromatogram> &lt;XChromatogram> &lt;XChromatogram></pre></td></tr><tr><td data-num="10"></td><td><pre>## [1,]        peaks: 0        peaks: 0        peaks: 0        peaks: 0</pre></td></tr><tr><td data-num="11"></td><td><pre>## [2,]        peaks: 1        peaks: 1        peaks: 1        peaks: 1</pre></td></tr><tr><td data-num="12"></td><td><pre>## [3,]        peaks: 1        peaks: 1        peaks: 1        peaks: 1</pre></td></tr><tr><td data-num="13"></td><td><pre>## [4,]        peaks: 1        peaks: 1        peaks: 0        peaks: 1</pre></td></tr><tr><td data-num="14"></td><td><pre>## phenoData with 3 variables</pre></td></tr><tr><td data-num="15"></td><td><pre>## featureData with 5 variables</pre></td></tr><tr><td data-num="16"></td><td><pre>## - - - xcms preprocessing - - -</pre></td></tr><tr><td data-num="17"></td><td><pre>## Chromatographic peak detection:</pre></td></tr><tr><td data-num="18"></td><td><pre>##  method: centWave</pre></td></tr><tr><td data-num="19"></td><td><pre>## Correspondence:</pre></td></tr><tr><td data-num="20"></td><td><pre>##  method: chromatographic peak density</pre></td></tr><tr><td data-num="21"></td><td><pre>##  4 feature(s) identified.</pre></td></tr></table></figure><p>绘制提取的离子色谱图。我们再次使用每个鉴定峰的组颜色来填充该区域。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>png<span class="token punctuation">(</span>file<span class="token operator">=</span><span class="token string">"xcms_24.png"</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="2"></td><td><pre>plot<span class="token punctuation">(</span>feature_chroms<span class="token punctuation">,</span> col <span class="token operator">=</span> sample_colors<span class="token punctuation">,</span> peakBg <span class="token operator">=</span> sample_colors<span class="token punctuation">[</span>chromPeaks<span class="token punctuation">(</span>feature_chroms<span class="token punctuation">)</span><span class="token punctuation">[</span><span class="token punctuation">,</span> <span class="token string">"sample"</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="3"></td><td><pre>dev.off<span class="token punctuation">(</span><span class="token punctuation">)</span></pre></td></tr></table></figure><p><img data-src="https://fastly.jsdelivr.net/gh/liaochenlanruo/cdn@master/img/custom/metabolomics/xcms_24.png" alt="Extracted ion chromatograms for features 1 to 4"><br>为了访问第二个特征的 EIC，我们可以简单地将 <code>feature_chros</code> 对象取子集。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre>eic_2 <span class="token operator">&lt;-</span> feature_chroms<span class="token punctuation">[</span><span class="token number">2</span><span class="token punctuation">,</span> <span class="token punctuation">]</span></pre></td></tr><tr><td data-num="2"></td><td><pre>chromPeaks<span class="token punctuation">(</span>eic_2<span class="token punctuation">)</span></pre></td></tr></table></figure><figure class="highlight text"><figcaption data-lang="text"></figcaption><table><tr><td data-num="1"></td><td><pre>mz mzmin mzmax       rt    rtmin    rtmax    into    intb  maxo sn</pre></td></tr><tr><td data-num="2"></td><td><pre>CP0055 205   205   205 2791.599 2771.048 2815.323 1924712 1850331 84280 64</pre></td></tr><tr><td data-num="3"></td><td><pre>CP0502 205   205   205 2795.355 2773.257 2820.612 1757151 1711473 68384 69</pre></td></tr><tr><td data-num="4"></td><td><pre>CP1049 205   205   205 2795.936 2773.877 2821.143 1383417 1334570 47384 54</pre></td></tr><tr><td data-num="5"></td><td><pre>CP1277 205   205   205 2788.642 2768.195 2812.229 1180288 1126958 48336 32</pre></td></tr><tr><td data-num="6"></td><td><pre>CP1567 205   205   205 2782.355 2761.949 2805.895 2129885 2054677 93312 44</pre></td></tr><tr><td data-num="7"></td><td><pre>CP2005 205   205   205 2787.051 2766.690 2812.111 1634342 1566379 67984 53</pre></td></tr><tr><td data-num="8"></td><td><pre>CP2392 205   205   205 2790.157 2763.587 2821.427 1623589 1531573 49208 28</pre></td></tr><tr><td data-num="9"></td><td><pre>CP2649 205   205   205 2787.032 2766.714 2812.043 1354005 1299188 55712 35</pre></td></tr><tr><td data-num="10"></td><td><pre>       sample row column</pre></td></tr><tr><td data-num="11"></td><td><pre>CP0055      1   1      1</pre></td></tr><tr><td data-num="12"></td><td><pre>CP0502      2   1      2</pre></td></tr><tr><td data-num="13"></td><td><pre>CP1049      3   1      3</pre></td></tr><tr><td data-num="14"></td><td><pre>CP1277      4   1      4</pre></td></tr><tr><td data-num="15"></td><td><pre>CP1567      5   1      5</pre></td></tr><tr><td data-num="16"></td><td><pre>CP2005      6   1      6</pre></td></tr><tr><td data-num="17"></td><td><pre>CP2392      7   1      7</pre></td></tr><tr><td data-num="18"></td><td><pre>CP2649      8   1      8</pre></td></tr></table></figure><p>最后，我们进行了主成分分析，以评估本实验中样本的分组。注意，我们没有执行任何数据标准化，因此分组可能（也将）受到技术偏见的影响。</p><figure class="highlight r"><figcaption data-lang="r"></figcaption><table><tr><td data-num="1"></td><td><pre><span class="token comment">## Extract the features and log2 transform them</span></pre></td></tr><tr><td data-num="2"></td><td><pre>ft_ints <span class="token operator">&lt;-</span> log2<span class="token punctuation">(</span>assay<span class="token punctuation">(</span>res<span class="token punctuation">,</span> <span class="token string">"raw_filled"</span><span class="token punctuation">)</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="3"></td><td><pre></pre></td></tr><tr><td data-num="4"></td><td><pre><span class="token comment">## Perform the PCA omitting all features with an NA in any of the</span></pre></td></tr><tr><td data-num="5"></td><td><pre><span class="token comment">## samples. Also, the intensities are mean centered.</span></pre></td></tr><tr><td data-num="6"></td><td><pre>pc <span class="token operator">&lt;-</span> prcomp<span class="token punctuation">(</span>t<span class="token punctuation">(</span>na.omit<span class="token punctuation">(</span>ft_ints<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span> center <span class="token operator">=</span> <span class="token boolean">TRUE</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="7"></td><td><pre></pre></td></tr><tr><td data-num="8"></td><td><pre><span class="token comment">## Plot the PCA</span></pre></td></tr><tr><td data-num="9"></td><td><pre>cols <span class="token operator">&lt;-</span> group_colors<span class="token punctuation">[</span>xdata<span class="token operator">$</span>sample_group<span class="token punctuation">]</span></pre></td></tr><tr><td data-num="10"></td><td><pre>pcSummary <span class="token operator">&lt;-</span> summary<span class="token punctuation">(</span>pc<span class="token punctuation">)</span></pre></td></tr><tr><td data-num="11"></td><td><pre></pre></td></tr><tr><td data-num="12"></td><td><pre>png<span class="token punctuation">(</span>file<span class="token operator">=</span><span class="token string">"xcms_25.png"</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="13"></td><td><pre>plot<span class="token punctuation">(</span>pc<span class="token operator">$</span>x<span class="token punctuation">[</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">]</span><span class="token punctuation">,</span> pc<span class="token operator">$</span>x<span class="token punctuation">[</span><span class="token punctuation">,</span><span class="token number">2</span><span class="token punctuation">]</span><span class="token punctuation">,</span> pch <span class="token operator">=</span> <span class="token number">21</span><span class="token punctuation">,</span> main <span class="token operator">=</span> <span class="token string">""</span><span class="token punctuation">,</span> xlab <span class="token operator">=</span> paste0<span class="token punctuation">(</span><span class="token string">"PC1: "</span><span class="token punctuation">,</span> format<span class="token punctuation">(</span>pcSummary<span class="token operator">$</span>importance<span class="token punctuation">[</span><span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">]</span> <span class="token operator">*</span> <span class="token number">100</span><span class="token punctuation">,</span> digits <span class="token operator">=</span> <span class="token number">3</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token string">" % variance"</span><span class="token punctuation">)</span><span class="token punctuation">,</span> ylab <span class="token operator">=</span> paste0<span class="token punctuation">(</span><span class="token string">"PC2: "</span><span class="token punctuation">,</span> format<span class="token punctuation">(</span>pcSummary<span class="token operator">$</span>importance<span class="token punctuation">[</span><span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">]</span> <span class="token operator">*</span> <span class="token number">100</span><span class="token punctuation">,</span> digits <span class="token operator">=</span> <span class="token number">3</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token string">" % variance"</span><span class="token punctuation">)</span><span class="token punctuation">,</span> col <span class="token operator">=</span> <span class="token string">"darkgrey"</span><span class="token punctuation">,</span> bg <span class="token operator">=</span> cols<span class="token punctuation">,</span> cex <span class="token operator">=</span> <span class="token number">2</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="14"></td><td><pre>grid<span class="token punctuation">(</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="15"></td><td><pre>text<span class="token punctuation">(</span>pc<span class="token operator">$</span>x<span class="token punctuation">[</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">]</span><span class="token punctuation">,</span> pc<span class="token operator">$</span>x<span class="token punctuation">[</span><span class="token punctuation">,</span><span class="token number">2</span><span class="token punctuation">]</span><span class="token punctuation">,</span> labels <span class="token operator">=</span> xdata<span class="token operator">$</span>sample_name<span class="token punctuation">,</span> col <span class="token operator">=</span> <span class="token string">"darkgrey"</span><span class="token punctuation">,</span> pos <span class="token operator">=</span> <span class="token number">3</span><span class="token punctuation">,</span> cex <span class="token operator">=</span> <span class="token number">2</span><span class="token punctuation">)</span></pre></td></tr><tr><td data-num="16"></td><td><pre>dev.off<span class="token punctuation">(</span><span class="token punctuation">)</span></pre></td></tr></table></figure><p><img data-src="https://fastly.jsdelivr.net/gh/liaochenlanruo/cdn@master/img/custom/metabolomics/xcms_25.png" alt="PCA for the faahKO data set, un-normalized intensities"></p><p>我们可以在 PC2 上看到 KO 和 WT 样品之间的预期分离。在 PC1 上样本根据其 ID 进行分离，ID&lt;=18 的样本与 ID&gt;18 的样本被分开。这种分离可能是由于技术偏差（例如，在不同的天 / 周进行的测量）或由于所分析小鼠的生物学特性（性别、年龄、产仔等）造成的。</p><h1 id="further-data-processing-and-analysis"><a class="anchor" href="#further-data-processing-and-analysis">#</a> Further data processing and analysis</h1><p>标准化特征的信号强度是必需的，但目前 xcms 还不支持（在不久的将来可能会添加一些方法）。建议将 <code>quantify</code> 方法返回的 <code>SummarizedExperiment</code> 用于任何进一步的数据处理，因为这种类型的对象在同一对象中存储特征定义（feature definitions）、样本注释以及特征丰度。为了识别例如具有显著不同强度 / 丰度的特征，建议使用其他 R 包中提供的功能，例如 Bioconductor 的 <code>limma</code> 包。为了支持依赖于旧 <code>xcmsSet</code> 结果对象的其他包，可以使用 <code>xset &lt;- as(x, &quot;xcmsSet&quot;)</code> 将新的 <code>XCMSnExp</code> 对象强制转换为 <code>xcmsSet</code> 对象，其中 x 是 <code>XCMSnExp</code> 对象。</p><h1 id="参考"><a class="anchor" href="#参考">#</a> 参考</h1><ul><li><span class="exturl" data-url="aHR0cDovLzEyNy4wLjAuMToyNDY3Ni9saWJyYXJ5L3hjbXMvZG9jL3hjbXMuaHRtbA==">LCMS data preprocessing and analysis with xcms</span></li></ul><p>关注公众号 “生信之巅”。</p><table align="center"><tr><td align="center"><img data-src="https://cdn.jsdelivr.net/gh/liaochenlanruo/cdn@master/img/social/生信之巅公众号.jpg" alt="生信之巅微信公众号" style="width:100px;height:100px;vertical-align:-20px;border-radius:0;margin-right:0;margin-bottom:5px;align:center"></td><td align="center"><img data-src="https://cdn.jsdelivr.net/gh/liaochenlanruo/cdn@master/img/social/小程序码.png" alt="生信之巅小程序码" style="width:100px;height:100px;vertical-align:-20px;border-radius:0;margin-left:0;margin-bottom:5px;align:center"></td></tr></table><p><font color="#FF0000"><ruby><b>敬告</b>：使用文中脚本请引用本文网址，转载请注明出处请尊重本人的劳动成果，谢谢！<rt><b>Notice</b>: When you use the scripts in this article, please cite the link of this webpage. Thank you!</rt></ruby></font></p><div class="tags"><a href="/tags/%E7%94%9F%E4%BF%A1%E8%BD%AF%E4%BB%B6/" rel="tag"><i class="ic i-tag"></i> 生信软件</a> <a href="/tags/%E4%BB%A3%E8%B0%A2%E7%BB%84/" rel="tag"><i class="ic i-tag"></i> 代谢组</a></div></div><footer><div class="meta"><span class="item"><span class="icon"><i class="ic i-calendar-check"></i> </span><span class="text">Edited on</span> <time title="Modified: 2023-05-19 08:57:07" itemprop="dateModified" datetime="2023-05-19T08:57:07+08:00">2023-05-19</time> </span><span id="post/377e.html" class="item leancloud_visitors" data-flag-title="使用xcms3处理和分析LC-MS数据" title="Views"><span class="icon"><i class="ic i-eye"></i> </span><span class="text">Views</span> <span class="leancloud-visitors-count"></span> <span class="text">times</span></span></div><div class="reward"><button><i class="ic i-heartbeat"></i> Donate</button><p>Give me a cup of [coffee]~(￣▽￣)~*</p><div id="qr"><div><img data-src="/images/reward-wepays.jpg" alt="Hualin Liu WeChat Pay"><p>WeChat Pay</p></div><div><img data-src="/images/AliPays.jpg" alt="Hualin Liu Alipay"><p>Alipay</p></div></div></div><div id="copyright"><ul><li class="author"><strong>Post author: </strong>liaochenlanruo <i class="ic i-at"><em>@</em></i>了尘兰若的小坑</li><li class="link"><strong>Post link: </strong><a href="https://liaochenlanruo.gitee.io/post/377e.html" title="使用xcms3处理和分析LC-MS数据">https://liaochenlanruo.gitee.io/post/377e.html</a></li><li class="license"><strong>Copyright Notice: </strong>All articles in this blog are licensed under <span class="exturl" data-url="aHR0cHM6Ly9jcmVhdGl2ZWNvbW1vbnMub3JnL2xpY2Vuc2VzL2J5LW5jLXNhLzQuMC9kZWVkLnpo"><i class="ic i-creative-commons"><em>(CC)</em></i>BY-NC-SA</span> unless stating additionally.</li></ul></div></footer></article></div><div class="post-nav"><div class="item left"><a href="/post/33b.html" itemprop="url" rel="prev" data-background-image="https:&#x2F;&#x2F;cdn.jsdelivr.net&#x2F;gh&#x2F;liaochenlanruo&#x2F;cdn@master&#x2F;img&#x2F;custom&#x2F;bgs&#x2F;thumb_103.webp" title="代谢组相关软件的安装及使用"><span class="type">Previous Post</span> <span class="category"><i class="ic i-flag"></i> 生物信息</span><h3>代谢组相关软件的安装及使用</h3></a></div><div class="item right"><a href="/post/df57.html" itemprop="url" rel="next" data-background-image="https:&#x2F;&#x2F;cdn.jsdelivr.net&#x2F;gh&#x2F;liaochenlanruo&#x2F;cdn@master&#x2F;img&#x2F;custom&#x2F;bgs&#x2F;thumb_104.webp" title="用metid构建代谢组数据库"><span class="type">Next Post</span> <span class="category"><i class="ic i-flag"></i> 生物信息</span><h3>用metid构建代谢组数据库</h3></a></div></div><div class="wrap" id="comments"></div></div><div id="sidebar"><div class="inner"><div class="panels"><div class="inner"><div class="contents panel pjax" data-title="Contents"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#%E4%BB%8B%E7%BB%8D"><span class="toc-number">1.</span> <span class="toc-text">介绍</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%AE%89%E8%A3%85"><span class="toc-number">2.</span> <span class="toc-text">安装</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%AF%BC%E5%85%A5%E6%95%B0%E6%8D%AE"><span class="toc-number">3.</span> <span class="toc-text">导入数据</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%88%9D%E5%A7%8B%E6%95%B0%E6%8D%AE%E6%A3%80%E6%9F%A5"><span class="toc-number">4.</span> <span class="toc-text">初始数据检查</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E8%89%B2%E8%B0%B1%E5%B3%B0%E6%A3%80%E6%B5%8B"><span class="toc-number">5.</span> <span class="toc-text">色谱峰检测</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#alignment"><span class="toc-number">6.</span> <span class="toc-text">Alignment</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#subset-based-alignment"><span class="toc-number">6.1.</span> <span class="toc-text">Subset-based alignment</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#correspondence"><span class="toc-number">7.</span> <span class="toc-text">Correspondence</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#further-data-processing-and-analysis"><span class="toc-number">8.</span> <span class="toc-text">Further data processing and analysis</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%8F%82%E8%80%83"><span class="toc-number">9.</span> <span class="toc-text">参考</span></a></li></ol></div><div class="related panel pjax" data-title="Related"><ul><li><a href="/post/19824.html" rel="bookmark" title="生物信息学1：VMware虚拟机及Bio-linux安装与配置">生物信息学1：VMware虚拟机及Bio-linux安装与配置</a></li><li><a href="/post/9.html" rel="bookmark" title="生物信息学2：VirtualBox虚拟机及Bio-Linux安装">生物信息学2：VirtualBox虚拟机及Bio-Linux安装</a></li><li><a href="/post/10877.html" rel="bookmark" title="生物信息学3：微生物基因组学常用软件安装">生物信息学3：微生物基因组学常用软件安装</a></li><li><a href="/post/30650.html" rel="bookmark" title="根据基因组预测表型 —— traitar的安装与使用">根据基因组预测表型 —— traitar的安装与使用</a></li><li><a href="/post/44606.html" rel="bookmark" title="kSNP3寻找SNPs并构建进化树">kSNP3寻找SNPs并构建进化树</a></li><li><a href="/post/43504.html" rel="bookmark" title="用wget批量下载含有链接的文件/目录">用wget批量下载含有链接的文件/目录</a></li><li><a href="/post/94f2.html" rel="bookmark" title="为PubMed添加功能">为PubMed添加功能</a></li><li><a href="/post/4e1.html" rel="bookmark" title="OrthoFinder2—同源蛋白家族聚类">OrthoFinder2—同源蛋白家族聚类</a></li><li><a href="/post/848f.html" rel="bookmark" title="PGCGAP中文说明">PGCGAP中文说明</a></li><li><a href="/post/d163.html" rel="bookmark" title="Bioconda贡献指南">Bioconda贡献指南</a></li><li><a href="/post/f6c9.html" rel="bookmark" title="Linux和基因组测序技术初识">Linux和基因组测序技术初识</a></li><li><a href="/post/5908.html" rel="bookmark" title="BtToxin_Digger--A high-throughput Bacillus thuringiensis toxin mining pipeline">BtToxin_Digger--A high-throughput Bacillus thuringiensis toxin mining pipeline</a></li><li><a href="/post/ab1b.html" rel="bookmark" title="宏基因组分析流程及代码">宏基因组分析流程及代码</a></li><li><a href="/post/4cf4.html" rel="bookmark" title="Use microeco分析扩增子数据">Use microeco分析扩增子数据</a></li><li><a href="/post/1755.html" rel="bookmark" title="扩增子分析--计算随机过程和决定性过程比例">扩增子分析--计算随机过程和决定性过程比例</a></li><li><a href="/post/e7e9.html" rel="bookmark" title="根据assession number批量从NCB下载数据">根据assession number批量从NCB下载数据</a></li><li><a href="/post/e922.html" rel="bookmark" title="Swissprot数据库的本地化与序列比对并与其他数据库快速mapping">Swissprot数据库的本地化与序列比对并与其他数据库快速mapping</a></li><li><a href="/post/412a.html" rel="bookmark" title="构建样本vs基因矩阵">构建样本vs基因矩阵</a></li><li><a href="/post/9052.html" rel="bookmark" title="CAZy碳水化合物活性酶预测">CAZy碳水化合物活性酶预测</a></li><li><a href="/post/5324.html" rel="bookmark" title="原核生物基因岛预测">原核生物基因岛预测</a></li><li><a href="/post/d9f9.html" rel="bookmark" title="按照Contig切割GenBank文件">按照Contig切割GenBank文件</a></li><li><a href="/post/3a23.html" rel="bookmark" title="从GenBank文件中提取Features">从GenBank文件中提取Features</a></li><li><a href="/post/fb68.html" rel="bookmark" title="使用EffectiveT3预测微生物中的III型分泌系统效应蛋白">使用EffectiveT3预测微生物中的III型分泌系统效应蛋白</a></li><li><a href="/post/c886.html" rel="bookmark" title="SignalP+TMHMM预测微生物分泌蛋白">SignalP+TMHMM预测微生物分泌蛋白</a></li><li><a href="/post/6a93.html" rel="bookmark" title="在FASTA文件中搜索完全匹配的短序列">在FASTA文件中搜索完全匹配的短序列</a></li><li><a href="/post/ea71.html" rel="bookmark" title="在Linux服务器中安装网页版Rstudio">在Linux服务器中安装网页版Rstudio</a></li><li><a href="/post/a713.html" rel="bookmark" title="R语言安装依赖包错误集锦">R语言安装依赖包错误集锦</a></li><li><a href="/post/d444.html" rel="bookmark" title="NCBI上传基因簇之tbl2asn的使用">NCBI上传基因簇之tbl2asn的使用</a></li><li><a href="/post/18ea.html" rel="bookmark" title="利用NCycDB数据库从宏基因组中预测氮循环基因">利用NCycDB数据库从宏基因组中预测氮循环基因</a></li><li><a href="/post/36cc.html" rel="bookmark" title="R语言绘制分组条形图">R语言绘制分组条形图</a></li><li><a href="/post/1551.html" rel="bookmark" title="宏病毒组分析流程1-VirSorter2">宏病毒组分析流程1-VirSorter2</a></li><li><a href="/post/8fb3.html" rel="bookmark" title="利用GTDB-TK对细菌和古菌基因组进行物种分类">利用GTDB-TK对细菌和古菌基因组进行物种分类</a></li><li><a href="/post/85d7.html" rel="bookmark" title="计算蛋白质等电点并绘制全局pI图">计算蛋白质等电点并绘制全局pI图</a></li><li><a href="/post/92eb.html" rel="bookmark" title="使用DeepARG预测抗生素抗性基因ARGs">使用DeepARG预测抗生素抗性基因ARGs</a></li><li><a href="/post/74ad.html" rel="bookmark" title="Nanopore基因组组装">Nanopore基因组组装</a></li><li><a href="/post/2581.html" rel="bookmark" title="使用eggNOG-mapper注释基因组">使用eggNOG-mapper注释基因组</a></li><li><a href="/post/d862.html" rel="bookmark" title="PGCGAP - the Prokaryotic Genomics and Comparative Genomics Analysis Pipeline v1.0.33">PGCGAP - the Prokaryotic Genomics and Comparative Genomics Analysis Pipeline v1.0.33</a></li><li><a href="/post/e6ae.html" rel="bookmark" title="利用PGCGAP根据ids提取序列信息">利用PGCGAP根据ids提取序列信息</a></li><li><a href="/post/213.html" rel="bookmark" title="多种方法批量下载NCBI基因组">多种方法批量下载NCBI基因组</a></li><li><a href="/post/33b.html" rel="bookmark" title="代谢组相关软件的安装及使用">代谢组相关软件的安装及使用</a></li><li class="active"><a href="/post/377e.html" rel="bookmark" title="使用xcms3处理和分析LC-MS数据">使用xcms3处理和分析LC-MS数据</a></li><li><a href="/post/df57.html" rel="bookmark" title="用metid构建代谢组数据库">用metid构建代谢组数据库</a></li><li><a href="/post/0.html" rel="bookmark" title="基于TidyMass的非靶向代谢组学分析">基于TidyMass的非靶向代谢组学分析</a></li><li><a href="/post/29bf.html" rel="bookmark" title="批量下载某研究方向重要文献">批量下载某研究方向重要文献</a></li><li><a href="/post/c617.html" rel="bookmark" title="16S扩增子测序及宏基因组测序">16S扩增子测序及宏基因组测序</a></li><li><a href="/post/1177.html" rel="bookmark" title="用MaAsLin2包做微生物组多变量线性模型关联分析">用MaAsLin2包做微生物组多变量线性模型关联分析</a></li><li><a href="/post/7449.html" rel="bookmark" title="NCBI上传基因簇之table2asn的使用">NCBI上传基因簇之table2asn的使用</a></li></ul></div><div class="overview panel" data-title="Overview"><div class="author" itemprop="author" itemscope itemtype="http://schema.org/Person"><img class="image" itemprop="image" alt="Hualin Liu" data-src="/images/head.jpg"><p class="name" itemprop="name">Hualin Liu</p><div class="description" itemprop="description">分享微生物生物信息学分析方法，欢迎加入QQ群交流945751012，不接受群内广告！</div></div><nav class="state"><div class="item posts"><a href="/archives/"><span class="count">130</span> <span class="name">posts</span></a></div><div class="item categories"><a href="/categories/"><span class="count">12</span> <span class="name">categories</span></a></div><div class="item tags"><a href="/tags/"><span class="count">54</span> <span class="name">tags</span></a></div></nav><div class="social"><span class="exturl item github" data-url="aHR0cDovL2dpdGh1Yi5jb20vbGlhb2NoZW5sYW5ydW8=" title="http:&#x2F;&#x2F;github.com&#x2F;liaochenlanruo"><i class="ic i-github"></i></span> <span class="exturl item zhihu" data-url="aHR0cHM6Ly93d3cuemhpaHUuY29tL3Blb3BsZS9zdWFuLWxhLW1pYW4tcGlhbi10YW5nLWNpdW0=" title="https:&#x2F;&#x2F;www.zhihu.com&#x2F;people&#x2F;suan-la-mian-pian-tang-cium"><i class="ic i-zhihu"></i></span> <span class="exturl item weibo" data-url="aHR0cHM6Ly93ZWliby5jb20vdS8yNzE1MjEwOTIz" title="https:&#x2F;&#x2F;weibo.com&#x2F;u&#x2F;2715210923"><i class="ic i-weibo"></i></span> <span class="exturl item about" data-url="aHR0cHM6Ly93d3cubGlhb2NoZW5sYW5ydW8uZnVuL2Fib3V0" title="https:&#x2F;&#x2F;www.liaochenlanruo.fun&#x2F;about"><i class="ic i-address-card"></i></span> <span class="exturl item email" data-url="bWFpbHRvOmxpYW9jaGVubGFucnVvQHdlYm1haWwuaHphdS5lZHUuY24=" title="mailto:liaochenlanruo@webmail.hzau.edu.cn"><i class="ic i-envelope"></i></span> <span class="exturl item douban" data-url="aHR0cHM6Ly93d3cuZG91YmFuLmNvbS9wZW9wbGUvbGlhb2NoZW5sYW5ydW8vP19pPTczNDYxMjVRalo1QjZWLw==" title="https:&#x2F;&#x2F;www.douban.com&#x2F;people&#x2F;liaochenlanruo&#x2F;?_i&#x3D;7346125QjZ5B6V&#x2F;"><i class="ic i-douban"></i></span> <span class="exturl item google" data-url="aHR0cHM6Ly9zY2hvbGFyLmdvb2dsZS5jby5qcC9jaXRhdGlvbnM/dXNlcj1YYW9STk1RQUFBQUomaGw9amE=" title="https:&#x2F;&#x2F;scholar.google.co.jp&#x2F;citations?user&#x3D;XaoRNMQAAAAJ&amp;hl&#x3D;ja"><i class="ic i-google"></i></span></div><ul class="menu"><li class="item"><a href="/" rel="section"><i class="ic i-home"></i>Home</a></li><li class="item dropdown"><a href="javascript:void(0);"><i class="ic i-user"></i>About</a><ul class="submenu"><li class="item"><a href="/about/" rel="section"><i class="ic i-user"></i>About me</a></li><li class="item"><a href="/comment/" rel="section"><i class="ic i-envelope"></i>Comment</a></li></ul></li><li class="item dropdown"><a href="javascript:void(0);"><i class="ic i-feather"></i>Posts</a><ul class="submenu"><li class="item"><a href="/archives/" rel="section"><i class="ic i-list-alt"></i>Archives</a></li><li class="item"><a href="/categories/" rel="section"><i class="ic i-th"></i>Categories</a></li><li class="item"><a href="/tags/" rel="section"><i class="ic i-tags"></i>Tags</a></li></ul></li><li class="item dropdown"><a href="javascript:void(0);"><i class="ic i-list-ol"></i>List</a><ul class="submenu"><li class="item"><a href="/photos/" rel="section"><i class="ic i-person"></i>Photos</a></li><li class="item"><a href="/skip/gallery/" rel="section"><i class="ic i-cloud"></i>Gallery</a></li><li class="item"><a href="/skip/box/" rel="section"><i class="ic i-magic"></i>Box</a></li><li class="item"><span class="exturl" data-url="aHR0cHM6Ly9saWFvY2hlbmxhbnJ1by5mdW4vcmVmZXJlbmNlLw=="><i class="ic i-th"></i>cheatsheets</span></li></ul></li><li class="item"><a href="/donate/" rel="section"><i class="ic i-coffee"></i>Donate</a></li><li class="item"><a href="/friends/" rel="section"><i class="ic i-heart"></i>Friends</a></li><li class="item"><span class="exturl" data-url="aHR0cHM6Ly9saWFvY2hlbmxhbnJ1by5naXRodWIuaW8="><i class="ic i-external-link-alt"></i>中文版</span></li><li class="item"><span class="exturl" data-url="aHR0cHM6Ly90cmF2ZWxsaW5ncy5saW5r"><i class="ic i-forward"></i>Travelling</span></li></ul></div></div></div><ul id="quick"><li class="prev pjax"><a href="/post/33b.html" rel="prev" title="Previous Post"><i class="ic i-chevron-left"></i></a></li><li class="up"><i class="ic i-arrow-up"></i></li><li class="down"><i class="ic i-arrow-down"></i></li><li class="next pjax"><a href="/post/df57.html" rel="next" title="Next Post"><i class="ic i-chevron-right"></i></a></li><li class="percent"></li></ul></div></div><div class="dimmer"></div></div></main><footer id="footer"><div class="inner"><div class="widgets"></div><div class="status"><div class="copyright">&copy; 2018 – <span itemprop="copyrightYear">2024</span> <span class="with-love"><i class="ic i-sakura rotate"></i> </span><span class="author" itemprop="copyrightHolder">Hualin Liu @ ResearchGo</span></div><div class="count"><span class="post-meta-item-icon"><i class="ic i-chart-area"></i> </span><span title="Symbols count total">788k words</span> <span class="post-meta-divider">|</span> <span class="post-meta-item-icon"><i class="ic i-coffee"></i> </span><span title="Reading time total">11:57</span><script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script><span class="post-meta-divider">|</span> <span class="post-meta-item-icon"><i class="ic i-info-circle"></i> </span><span style="padding-left:1px"><span id="busuanzi_container_site_pv">Total visits: <span id="busuanzi_value_site_pv" style="color:#f99"></span> times</span> <span class="post-meta-divider">|</span> <span class="post-meta-item-icon"><i class="ic i-user"></i> </span><span style="padding-left:1px"><span id="busuanzi_container_site_uv">Total visitors: <span id="busuanzi_value_site_uv" style="color:#f99"></span> people</span></span></span></div><div class="powered-by">Powered by <span class="exturl" data-url="aHR0cHM6Ly9oZXhvLmlv">Hexo</span> & Theme.<span class="exturl" data-url="aHR0cHM6Ly9naXRodWIuY29tL2FtZWhpbWUvaGV4by10aGVtZS1zaG9rYQ==">Shoka</span></div></div></div></footer></div><script data-config type="text/javascript">var LOCAL={path:"post/377e.html",favicon:{show:"（●´3｀●）Goooood",hide:"(´Д｀)Booooom"},search:{placeholder:"Search for Posts",empty:"We didn't find any results for the search: ${query}",stats:"${hits} results found in ${time} ms"},valine:!0,fancybox:!0,copyright:'Copied to clipboard successfully! <br> All articles in this blog are licensed under <i class="ic i-creative-commons"></i>BY-NC-SA.',ignores:[function(e){return e.includes("#")},function(e){return new RegExp(LOCAL.path+"$").test(e)}]}</script><script src="https://cdn.polyfill.io/v2/polyfill.js"></script><script src="//cdn.jsdelivr.net/combine/npm/pace-js@1.0.2/pace.min.js,npm/pjax@0.2.8/pjax.min.js,npm/whatwg-fetch@3.4.0/dist/fetch.umd.min.js,npm/animejs@3.2.0/lib/anime.min.js,npm/algoliasearch@4/dist/algoliasearch-lite.umd.js,npm/instantsearch.js@4/dist/instantsearch.production.min.js,npm/lozad@1/dist/lozad.min.js,npm/quicklink@2/dist/quicklink.umd.js"></script><script src="/js/app.js?v=0.2.5"></script><script data-pjax>var _hmt=_hmt||[];!function(){var e=document.createElement("script");e.src="https://hm.baidu.com/hm.js?d211830a796ceefb38a141fde14e4d5a";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)}()</script></body></html>